Subsetting a Data File Containing Cross Sections |
Data files containing cross sections can be subsetted by controlling which cross sections to include in the output data set. Selecting a subset of cross sections is accomplished using the WHERE statement. The WHERE statement gives a condition that the BY variables must satisfy for a cross section to be selected. For example, the following statements extract the monthly market rate conversion factors for the United Kingdom (COUNTRY=’112’) and Switzerland (COUNTRY=’146’) for the period from September 1985 to February 1986.
filename datafile "%sysget(DATASRC_DATA)imfifs1.dat" RECFM=F LRECL=88; title3 'Time Series Defined in Selected Cross Sections'; proc datasource filetype=imfifsp outselect=on ebcdic interval=month out=ifs; where country in ('146', '112') and partner=' '; keep F___AA F___AC; range from '01sep85'd to '01feb86'd; run; title4 'OUTALL=IFS Data Set'; proc print data=ifs; run;