The RANGE statement is used to control the time range of observations included in the output data set. Figure 11.2 shows an example extracting the foreign exchange rates from September 1985 to February 1987, you can use the following statements:
/*-- Controlling the Time Range of Data - The RANGE Statement --*/
filename citifile "citiaf.dat" RECFM=F LRECL=80;
proc datasource filetype=dribasic infile=citifile
interval=month out=dataset;
keep exrjan exrsw exruk;
range from 1985:9 to 1987:2;
run;
title1 'Printout of the OUT= Data Set';
proc print data=dataset;
run;
Figure 11.2
Subset Obtained by KEEP and RANGE Statements
SEP1985 |
236.530 |
2.37490 |
136.420 |
OCT1985 |
214.680 |
2.16920 |
142.150 |
NOV1985 |
204.070 |
2.13060 |
143.960 |
DEC1985 |
202.790 |
2.10420 |
144.470 |
JAN1986 |
199.890 |
2.06600 |
142.440 |
FEB1986 |
184.850 |
1.95470 |
142.970 |
MAR1986 |
178.690 |
1.91500 |
146.740 |
APR1986 |
175.090 |
1.90160 |
149.850 |
MAY1986 |
167.030 |
1.85380 |
152.110 |
JUN1986 |
167.540 |
1.84060 |
150.850 |
JUL1986 |
158.610 |
1.74450 |
150.710 |
AUG1986 |
154.180 |
1.66160 |
148.610 |
SEP1986 |
154.730 |
1.65370 |
146.980 |
OCT1986 |
156.470 |
1.64330 |
142.640 |
NOV1986 |
162.850 |
1.68580 |
142.380 |
DEC1986 |
162.050 |
1.66470 |
143.930 |
JAN1987 |
154.830 |
1.56160 |
150.540 |
FEB1987 |
153.410 |
1.54030 |
152.800 |