Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
The DATASOURCE Procedure

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 2 digit year is specified, PROC DATASOURCE complies to year 2000 guidelines by using 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 2 digit year specification. The default YEARCUTOFF is 1920. To use a different yearcutoff, specify

options yearcutoff=yyyy;

where yyyy is the yearcutoff you want to use. See the SAS Language: Reference, Version 7, First Edition 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 is 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 is available, you can first run PROC DATASOURCE with the OUTBY= or OUTALL= options. 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.

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.