Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
The DATASOURCE Procedure

Controlling the Time Range of Data -- The RANGE Statement

The RANGE statement is used to control the time range of observations included in the output data set. For example, if you want to extract the foreign exchange rates from September, 1987 to February, 1988, you can use the following statements:

   filename citifile 'host-specific-file-name' <host-options>;
   proc datasource filetype=dribasic infile=citifile
                   interval=month  out=dataset;
      keep  exrjan exrsw exruk;
      range from 1987:9 to 1988:2;
   run;
   
   title1 'Printout of the OUT= Data Set';
   proc print data=dataset noobs;
   run;

Printout of the OUT= Data Set

date exrjan exrsw exruk
SEP1987 143.290 1.50290 164.460
OCT1987 143.320 1.49400 166.200
NOV1987 135.400 1.38250 177.540
DEC1987 128.240 1.33040 182.880
JAN1988 127.690 1.34660 180.090
FEB1988 129.170 1.39160 175.820

Figure 10.3: Subset Obtained by KEEP and RANGE Statements

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

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