Resources

Subsetting a Data File Containing Cross Sections


/*--------------------------------------------------------------

                    SAS Sample Library

        Name: datgs05.sas
 Description: Example program from SAS/ETS User's Guide,
              The DATASOURCE Procedure

   Title: Subsetting a Data File Containing Cross Sections
 Product: SAS/ETS Software
  System: ALL
    Keys: DATASOURCE  data extraction from various sources
   Procs: DATASOURCE
    Data: sasmisc: imfifs1.dat (DATASOURCE database files)
   Notes: Read this before you run this sample.
          The database resides in the ets/sasmisc folder. You
          must copy the database to a writeable folder before
          using it. Then define your Windows system environment
          variable, DATASRC_DATA, to the path of your
          writeable folder containing
          the imfifs1.dat file.
          To assign a fileref to the external file to be processed,
          use the following form of the filename statement:

filename ifsfile "%sysget(DATASRC_DATA)imfifs1.dat" RECFM=F LRECL=88;
--------------------------------------------------------------*/

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;