RANGE Statement
RANGE FROM from TO to ;

The RANGE statement selects the time range of observations written to the OUT= and OUTEVENT= data sets. The from and to values can be SAS date, time, or datetime constants, or they can be specified as year or year : period, where year is a two-digit or four-digit year, and period (when specified) is a period within the year corresponding to the INTERVAL= option. (For example, if INTERVAL=QTR, then period refers to quarters.) When period is omitted, the beginning of the year is assumed for the from value, and the end of the year is assumed for the to value.

If a two-digit year is specified, PROC DATASOURCE uses the current value of the YEARCUTOFF option to determine the century of your data. Warnings are issued in the SAS log whenever DATASOURCE needs to determine the century from a two-digit year specification.

The default YEARCUTOFF value is 1920. To use a different YEARCUTOFF value, specify

options yearcutoff=yyyy;

where YYYY is the YEARCUTOFF value you want to use. See SAS System Options: Reference for a more detailed discussion of the YEARCUTOFF option.

Both the FROM and TO specifications are optional, and both the FROM and TO keywords are optional. If the FROM limit is omitted, the output observations start with the minimum date for which data are available for any selected series. Similarly, if the TO limit is omitted, the output observations end with the maximum date for which data are available.

The following are some examples of RANGE statements:

   range from 1980 to 1990;
   range 1980 - 1990;
   range from 1980;
   range 1980;
   range to 1990;
   range to 1990:2;
   range from '31aug89'd to '28feb1990'd;

The RANGE statement applies to each BY group independently. If all the selected series contain no data in the specified range for a given BY group, then there will be no observations for that BY group in the OUT= and OUTEVENT= data sets.

If you want to know the time ranges for which periodic time series data are available, you can first run PROC DATASOURCE with the OUTBY= or OUTALL= option. The OUTBY= data set reports the union of the time ranges over all the series within each BY group, while the OUTALL= data set gives time ranges for each series separately in each BY group.