Quarterly COMPUSTAT Data Files
/*--------------------------------------------------------------
SAS Sample Library
Name: datex07.sas
Description: Example program from SAS/ETS User's Guide,
The DATASOURCE Procedure
Title: Quarterly COMPUSTAT Data Files
Product: SAS/ETS Software
System: ALL
Keys: DATASOURCE data extraction from various sources
Procs: DATASOURCE
Data: sasmisc: csqibm.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 csqibm.dat file.
To assign a fileref to the external file to be processed,
use the following filename statement:
filename compstat "%sysget(DATASRC_DATA)csqibm.dat" recfm=s370v lrecl=4820 blksize=14476;
--------------------------------------------------------------*/
filename compstat "%sysget(DATASRC_DATA)csqibm.dat" recfm=s370v
lrecl=4820 blksize=14476;
proc datasource filetype=cs48qibm infile=compstat
out=stocks outby=company;
keep data56 qftnt14;
rename data56=comstock qftnt14=ftcomstk;
label data56='Common Stock'
qftnt14='Footnote for Common Stock';
range from 1990:4;
run;
/*- add company name to the out= data set */
data stocks;
merge stocks company( keep=dnum cnum cic coname );
by dnum cnum cic;
run;
title1 'Common Stocks for Last Quarter of 1990';
proc print data=stocks ;
run;