Assignment 6

In the previous assignment, you created an ascii dataset that had for 100 companies the following compustat items:

cusip, yeara, fyr, and the following data items:
Items (see page 4, chapter 4 of the compustat manual)1 through 20, 25, 130, 60, 41, 61

These are:

1. Cash
2. Receivables
3. Inventories
4. Current Assets
5. Current Liabilities
6. Total Assets = Total Liabilities and Stockholders Equity
7. Gross PPE
8  Net PPE 
9.  Long Term Debt
10. Preferred Stock--liquidating value
11.  Common Equity
12.  Sales
13.  Operating Income Before Depreciation
14.  Depreciation and Amortization
15.  Interest Expense
16.  Income Taxes
17.  Special Items
18.  Income before Extraordinary Items
19.  Dividends--Preferred
20.  Income Before Extraordinary Items Admusted for Common Stock Equivalents
25.  Common Shares Outstanding
130.  Preferred Stock Carrying Value
60.  Common Equity Total
41. Cost of Goods Sold
61.  Non-Operating Income (Expense)


1.  Write a sas program to read this data set, assigning appropriate names for the variables.

2.  Put in code to check whether any of the variables are missing and to assign a missing value to missing variables (see below).

Missing observation codes

When data is missing from the Compustat Database, Compustat assigns a missing observation code.  You have to be careful when reading the data, because the missing observations are just coded as special numbers, and you might process the data as if it were actual accounting data rather than a missing observation code.  Following are the codes that Compustat uses, and what they mean:

Code Meaning
-0.001 Data not available. 
-0.007 Not Meaningful
-0.004 Combined Figure.  This item is combined into another data item.
-0.008 Insignificant figure.  The company has reported this item as insignificant
-0.002 Semi-annual figure.  If the data is only available on a semi-annual basis, then this code appears in the first and third quarter.  Actual data appear in the second and fourth quarters.

Probably the easiest way to do this code checking is to assign all of your variables to an array and then check the array.  This requires a lot of typing at the start, but makes processing the data easier in the long run.

To assign the array, suppose your 25 data variables are cash, rec, inv, .... nonopinc.   Then use the statement (fill in all 25 variables, and you can call it something other than "datarray" if you want)

array datarray{*} cash rec inv ...... nonopinc; 

(note:  don't put in the .....  put in the actual names of the variables.   The * means that SAS will count the items and figure out the size of the array itself.  You could use the statement array datarray{25} if you can count the items up yourself!)

Once you have assigned an array, you can reference the variables just like in fortran.   datarray{1} is cash,  datarray{25} is nonopinc.  To process the entire array, you can use a do loop:

do i = 1 to 25;
if datarray{i} = -0.001 then datarray{i} = .;
..
end;

you decide what to do with the other error codes.  The semi-annual figure won't appear on the annual files, so you don't have to worry about that.