Example 10.7: Quarterly COMPUSTAT Data Files
This example shows how to extract data from a 48-quarter Compustat Database
File. For COMPUSTAT data files, the series variable names are constructed by
concatenating the name of the data array DATA and the column number
containing the required information. For example, for quarterly files the common
stock data is in column 56. Therefore, the variable name for this series
is DATA56. Similarly, the series variable names for quarterly footnotes are
constructed by adding the column number to the array name, QFTNT. For
example, the variable name for common stock footnotes is QFTNT14 since the
14th column of the QFTNT array contains this information.
The following example extracts common stock series
(DATA56) and its footnote (QFTNT14) for
Computer Programming Service Companies
(DNUM=7371) and Prepackaged Software Companies (DNUM=7370)
whose stocks are traded over-the-counter and
not in the S&P 500 Index (ZLIST=06) and whose data reside in the
over-the-counter file (FILE=06).
filename compstat 'host-specific-Compustat-file-name' <host-options>;
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';
where dnum in (7370,7371) and zlist=06 and file=06;
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 Software Companies for 1990';
proc print data=stocks noobs;
where date between '01jan90'd and '31dec90'd;
run;
The Output 10.7.1 contains a partial listing of the STOCKS data set.
Output 10.7.1: Partial Listing of the OUT=STOCKS Data Set
|
| Common Stocks for Software Companies for 1990 |
| DNUM |
CNUM |
CIC |
FILE |
EIN |
STK |
SMBL |
ZLIST |
XREL |
FINC |
SINC |
state |
county |
date |
comstock |
ftcomstk |
CONAME |
| 7370 |
027352 |
103 |
6 |
54-0856778 |
0 |
AMSY |
6 |
0 |
0 |
10 |
51 |
13 |
1990:1 |
0.11500 |
|
AMERICAN MANAGEMENT SYSTEMS |
| 7370 |
027352 |
103 |
6 |
54-0856778 |
0 |
AMSY |
6 |
0 |
0 |
10 |
51 |
13 |
1990:2 |
0.11600 |
|
AMERICAN MANAGEMENT SYSTEMS |
| 7370 |
027352 |
103 |
6 |
54-0856778 |
0 |
AMSY |
6 |
0 |
0 |
10 |
51 |
13 |
1990:3 |
0.12200 |
|
AMERICAN MANAGEMENT SYSTEMS |
| 7370 |
027352 |
103 |
6 |
54-0856778 |
0 |
AMSY |
6 |
0 |
0 |
10 |
51 |
13 |
1990:4 |
0.11700 |
|
AMERICAN MANAGEMENT SYSTEMS |
| 7370 |
553412 |
107 |
6 |
73-1064024 |
0 |
MPSG |
6 |
0 |
0 |
10 |
40 |
143 |
1990:1 |
0.42400 |
|
MPSI SYSTEMS INC |
| 7370 |
553412 |
107 |
6 |
73-1064024 |
0 |
MPSG |
6 |
0 |
0 |
10 |
40 |
143 |
1990:2 |
0.42400 |
|
MPSI SYSTEMS INC |
| 7370 |
553412 |
107 |
6 |
73-1064024 |
0 |
MPSG |
6 |
0 |
0 |
10 |
40 |
143 |
1990:3 |
0.42400 |
|
MPSI SYSTEMS INC |
| 7370 |
553412 |
107 |
6 |
73-1064024 |
0 |
MPSG |
6 |
0 |
0 |
10 |
40 |
143 |
1990:4 |
0.42300 |
|
MPSI SYSTEMS INC |
| 7371 |
032681 |
108 |
6 |
41-0905408 |
0 |
ANLY |
6 |
0 |
0 |
27 |
27 |
53 |
1990:1 |
. |
|
ANALYSTS INTERNATIONAL CORP |
| 7371 |
032681 |
108 |
6 |
41-0905408 |
0 |
ANLY |
6 |
0 |
0 |
27 |
27 |
53 |
1990:2 |
. |
|
ANALYSTS INTERNATIONAL CORP |
| 7371 |
032681 |
108 |
6 |
41-0905408 |
0 |
ANLY |
6 |
0 |
0 |
27 |
27 |
53 |
1990:3 |
. |
|
ANALYSTS INTERNATIONAL CORP |
| 7371 |
032681 |
108 |
6 |
41-0905408 |
0 |
ANLY |
6 |
0 |
0 |
27 |
27 |
53 |
1990:4 |
0.46000 |
|
ANALYSTS INTERNATIONAL CORP |
| 7371 |
458816 |
105 |
6 |
04-2448936 |
0 |
IMET |
6 |
0 |
0 |
25 |
25 |
17 |
1990:1 |
0.03600 |
|
INTERMETRICS INC |
| 7371 |
458816 |
105 |
6 |
04-2448936 |
0 |
IMET |
6 |
0 |
0 |
25 |
25 |
17 |
1990:2 |
0.03600 |
|
INTERMETRICS INC |
| 7371 |
458816 |
105 |
6 |
04-2448936 |
0 |
IMET |
6 |
0 |
0 |
25 |
25 |
17 |
1990:3 |
0.03600 |
|
INTERMETRICS INC |
| 7371 |
458816 |
105 |
6 |
04-2448936 |
0 |
IMET |
6 |
0 |
0 |
25 |
25 |
17 |
1990:4 |
. |
|
INTERMETRICS INC |
| 7371 |
834021 |
107 |
6 |
04-2453033 |
0 |
SOFT |
6 |
0 |
0 |
25 |
25 |
17 |
1990:1 |
0.38700 |
|
SOFTECH INC |
| 7371 |
834021 |
107 |
6 |
04-2453033 |
0 |
SOFT |
6 |
0 |
0 |
25 |
25 |
17 |
1990:2 |
0.38700 |
|
SOFTECH INC |
| 7371 |
834021 |
107 |
6 |
04-2453033 |
0 |
SOFT |
6 |
0 |
0 |
25 |
25 |
17 |
1990:3 |
. |
|
SOFTECH INC |
| 7371 |
834021 |
107 |
6 |
04-2453033 |
0 |
SOFT |
6 |
0 |
0 |
25 |
25 |
17 |
1990:4 |
. |
|
SOFTECH INC |
| 7371 |
872885 |
108 |
6 |
13-2635899 |
0 |
TSRI |
6 |
0 |
0 |
10 |
36 |
103 |
1990:1 |
0.02500 |
|
TSR INC |
| 7371 |
872885 |
108 |
6 |
13-2635899 |
0 |
TSRI |
6 |
0 |
0 |
10 |
36 |
103 |
1990:2 |
0.02500 |
|
TSR INC |
| 7371 |
872885 |
108 |
6 |
13-2635899 |
0 |
TSRI |
6 |
0 |
0 |
10 |
36 |
103 |
1990:3 |
. |
|
TSR INC |
| 7371 |
872885 |
108 |
6 |
13-2635899 |
0 |
TSRI |
6 |
0 |
0 |
10 |
36 |
103 |
1990:4 |
. |
|
TSR INC |
| 7371 |
878351 |
105 |
6 |
41-0918564 |
0 |
TECN |
6 |
0 |
0 |
27 |
27 |
53 |
1990:1 |
0.21500 |
|
TECHNALYSIS CORP |
| 7371 |
878351 |
105 |
6 |
41-0918564 |
0 |
TECN |
6 |
0 |
0 |
27 |
27 |
53 |
1990:2 |
0.21600 |
|
TECHNALYSIS CORP |
| 7371 |
878351 |
105 |
6 |
41-0918564 |
0 |
TECN |
6 |
0 |
0 |
27 |
27 |
53 |
1990:3 |
0.21600 |
|
TECHNALYSIS CORP |
| 7371 |
878351 |
105 |
6 |
41-0918564 |
0 |
TECN |
6 |
0 |
0 |
27 |
27 |
53 |
1990:4 |
0.21600 |
|
TECHNALYSIS CORP |
|
Note that quarterly Compustat data are also available in Universal Character
format. If you have this type of file instead of IBM 360/370 General format,
use the FILETYPE=CS48QUC option instead.
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.