Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
The DATASOURCE Procedure

Example 10.10: CRSP 1995 CDROM Data Files

The normal character filetypes used for tape files may also be used for the CDROM character data. They are CRSPDCS, CRSPDCI, CRSPDCA for daily data and CRSPMCS, CRSPMCI, CRSPMCA for monthly data. It is necessary to use the LRECL=( 130 401 ) option on the DATASOURCE statement when processing CDROM character data as shown in the first DATASOURCE run.

The CRSP 1995 UNIX (SUN)Binary data is readable by PROC DATASOURCE using the filetypes CRSPDUS, CRSPDUI, CRSPDUA for daily files and filetypes CRSPMUS, CRSPMUI, CRSPMUA for monthly files. Both IEEE Big Endian and IEEE Little Endian machines may use the same CDROM UNIX Binary filetypes. PROC DATASOURCE can not read the PC Binary Data from CDROM, but the UNIX (SUN) Binary may be used from the same CDROM instead, even on PC's. The second DATASOURCE run shows how to access the 1995 UNIX Binary data.

   filename csec 'machar.dat' recfm=f lrecl=401;
   filename ccal 'msix.dat' recfm=f lrecl=130;
                           
   /*--------------------------------------------------------------*
    *       create output data sets without any subsetting         *
    *       character data from MA CDROM                           *
    *--------------------------------------------------------------*/
   /*- create calendar/indices output data sets using DATASOURCE  -*/
   /*- statements                                                 -*/
   proc datasource filetype=crspmcs  
                  infile=( ccal csec )
                  lrecl=( 130 401 )
                  interval=month
                  outselect=off
                  outcont=maccont outkey=mackey
                  out=mac outevent=macevent;
      keep _all_;
      keepevent _all_;
   run;

   title3 'MA/CDROM Security File Outputs';
   title4 'OUTKEY= Data Set';
   proc print data=mackey; run;

   title4 'OUTCONT= Data Set';
   proc print data=maccont; run;

   title4 'Listing of OUT= Data Set';
   proc print data=mac; run;

   title4 'Listing of OUTEVENT= Data Set';
   proc print data=macevent; run ;


   filename macal 'maucal95.data' lrecl=48;
   filename masec 'mausub95.data' recfm=v lrecl=32760;

   /*-------------------------------------------------------------*
    *       create output data sets without any subsetting        *
    *       UNIX (SUN) binary data from MA CDROM                  *
    *-------------------------------------------------------------*/
   /*- create calendar/indices output data sets using DATASOURCE -*/
   /*- statements                                                -*/
   proc datasource filetype=crspmus  
                  infile=( macal masec )
                  interval=month
                  outselect=off
                  outcont=macont outkey=makey
                  out=ma outevent=maevent;
      keep _all_;
      keepevent _all_;
   run;

   title3 'MA/CDROM Security File Outputs';
   title4 'OUTKEY= Data Set';
   proc print data=makey; run;

   title4 'OUTCONT= Data Set';
   proc print data=macont; run;

   title4 'Listing of OUT= Data Set';
   proc print data=ma; run;

   title4 'Listing of OUTEVENT= Data Set';
   proc print data=maevent; run ;

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

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