Command Reference : Command Reference
  
 
smpl
Set sample range.
The smpl command sets the workfile sample to use for statistical operations and series assignment expressions.
Syntax
smpl smpl_spec
smpl sample_name
List the date or number of the first observation and the date or number of the last observation for the sample. Rules for specifying dates are given in “Dates”. The sample spec may contain more than one pair of beginning and ending observations.
The smpl command also allows you to select observations on the basis of conditions specified in an if statement. This enables you to use logical operators to specify what observations to include in EViews’ procedures. Put the if statement after the pairs of dates.
You can also use smpl to set the current observations to the contents of a named sample object; put the name of the sample object after the keyword.
Special keywords for smpl
The following “@-keywords” can be used in a smpl command:
 
@all
The entire workfile range.
@first
The first observation in the workfile.
@last
The last observation in the workfile.
The following frequency functions may also be used:
 
@year
The four digit year in which the current observation begins.
@quarter
The quarter of the year in which the current observation begins.
@month
The month of the year in which the current observation begins.
@day
The day of the month in which the current observation begins.
@weekday
The day of the week in which the current observation begins, where Monday is given the number 1 and Sunday is given the number 7.
@hour
The observation hour as an integer. (9:30AM returns 9, 5:15PM returns 17.)
@minute
The observation minute as an integer. (9:30PM returns 30.)
@second
The observation second as an integer.
@hourf
The observation time as a floating point hour. (9:30AM returns 9.5, 5:15PM returns 17.25.)
In panel settings, you may use the additional keywords:
 
@firstmin
The earliest of the first observations (computed across cross-sections).
@firstmax
The latest of the first observations.
@lastmin
The earliest of the last observations.
@lastmax
The latest of the last observations.
Examples
smpl 1955m1 1972m12
sets the workfile sample from 1955M1 to 1972M12.
smpl @first 1940 1946 1972 1975 @last
excludes observations (or years) 1941–1945 and 1973–1974 from the workfile sample.
smpl if union=1 and edu<=15
sets the sample to those observations where UNION takes the value 1 and EDU is less than or equal to 15.
sample half @first @first+@obs(x)/2
smpl half
smpl if x>0
smpl @all if x>0
The first line declares a sample object named HALF which includes the first half of the series X. The second line sets the sample to HALF and the third line sets the sample to those observations in HALF where X is positive. The last line sets the sample to those observations where X is positive over the full sample.
The sample may be set for intraday data using optional times after the dates. For example,
smpl 1/3/2000 10AM 12/30/2000 2PM
removes any observations before 10AM on 1/3/2000 and after 2PM on 12/30/2000.
smpl if @hourf<=9.5 and @hourf<=14.5
sets the sample to include only observations between and including 9:30AM and 2:30PM.
smpl if @minute=0 or @minute=30
selects only observations that appear on the half hour.
smpl if @weekday=1 and @hourf=10
sets the sample to include only observations that appear on Mondays at 10AM.
Cross-references
See “Samples” for a discussion of samples in EViews.
See also Sample::set and Sample::sample.