Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
The DATASOURCE Procedure

Example 10.11: CRSP ACCESS97 CDROM Data Files

This example demonstrates how to work with the CRSP ACCESS97 CDROM data files by first running the CRSP supplied stk_dump_bin utility, to create a UNIX (SUN) binary file. The UNIX binary file can then be processed by PROC DATASOURCE using the CRSPMUS filetype for monthly data or the CRSPDUS filetype for DAILY data. The DATASOURCE procedure expects the data file to use IEEE big Endian byte ordering. The exact command that you need to use to convert the data depends on whether you extracted the big Endian or little Endian data off of the CD, and whether you are running on a host whose native binary representation is big or little Endian. Consult your 1997 CRSP ACCESS97 Stock File User's Guide, Appendix C for details on the reverse/keep option for the byte-ordering flag. Assuming a Windows NT platform and daily data:

ind_dump_bin %crsp_dstk% filename1 460 1000080 1000081 1000502 reverse unix
stk_dump_bin %crsp_dstk% filename2 10 1 0 0 0 reverse unix permlist_filename

Once you have converted the ACCESS97 data into the unix binary format, you are ready to invoke PROC DATASOURCE:

   filename calfile 'filename1';
   filename secfile 'filename2' lrecl=36000;

   proc datasource filetype=crspdus
      infile=( calfile secfile )
      interval=day
      outselect=off
      out=da outkey=dakey outcont=dacont outevent=daevent;
      keep _all_;
      keepevent _all_;
   run;

The above example uses an LRECL to accomodate the size of the 1997 daily data. Subsequent years may need a larger lrecl.

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

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