From: H Alan Montgomery <[email-masked]>
Date: Mon, 03 Feb 97 19:23:14 CST

Below is the long SAS program to read in BANK CompuStat. If you  want  to
add it to the FAQ, please do so.
-=<*>=-=<*>=-=<*>=-=<*>=-=<*>=-=<*>=-=<*>=-=<*>=-=<*>=-=<*>=-=<*>=-=<*>=-=<*>=-

* begin of fhd.bank.compustat.sas contributed by H. Alan Montgomery  ;
* Just these 2 comment lines and 2 more at the end added by doncram;

cms filedef work disk dummy dummy c;
cms filedef tapeLIS1 tap1 sl 1  ;
cms filedef LIS2 disk bank  parts   c ;
cms filedef COMPSTAT disk dummy dummy c;
OPTIONS SOURCE2 ERRORS=0;
******* MACRO TO BE USED IN EACH YEAR ******;
MACRO CHECK1
XX=.;
DO OVER I;II=I;IF I > 0. AND I < 0.0007 THEN I=.;
   IF I NE . THEN XX=YEAR;
   IF II > 0.0001 AND II < 0.0007 THEN I=II; END;
IF XX NE . THEN OUTPUT  ; %
DATA BORK1;
   INFILE tapeLIS1;
   LENGTH DNUM FILE ZLIST FYR I1-I232 ISSUE 4;
   ARRAY I(F) I1-I232;
   INPUT REC RB4. DNUM RB4. CNUM $8. CIC RB4. FILE RB4. ZLIST RB4.
     BLANK $4. CONAME $28.  INAME $28. SMBL $8. @;
   ISSUE=INT(CIC/10);
   IF DNUM=0 THEN DO;INPUT @261 XX RB4.;DELETE;RETURN;END;
   INPUT @97  (AFTNT1-AFTNT40)(40*$2.)
         @497 (I1-I232)(232*RB4.)
         @5137 FYR RB4. @5157 YEAR RB4. @;
   CHECK1
   INPUT @177 (AFTNT1-AFTNT40)(40*$2.)
         @1425 (I1-I232)(232*RB4.)
         @5141 FYR RB4. @5161 YEAR RB4. @;
   CHECK1
   INPUT @257 (AFTNT1-AFTNT40)(40*$2.)
         @2353 (I1-I232)(232*RB4.)
         @5145 FYR RB4. @5165 YEAR RB4. @;
   CHECK1
   INPUT @337 (AFTNT1-AFTNT40)(40*$2.)
         @3281 (I1-I232)(232*RB4.)
         @5149 FYR RB4. @5169 YEAR RB4. @;
   CHECK1
   INPUT @417 (AFTNT1-AFTNT40)(40*$2.)
         @4209 (I1-I232)(232*RB4.)
         @5153 FYR RB4. @5173 YEAR RB4.;
   CHECK1
DROP blank F CIC I19 I40 I42 I48 I64 I79 I94 I107;
label
DNUM    ='Industry classification number          '
CNUM    ='CUSIP Issuer Code                       '
ISSUE   ='Stock Issue Number                      '
FILE    ='File Identification Code                '
ZLIST   ='Exchange Listing and S&P Index Code     '
INAME   ='Industry Name                           '
CONAME  ='Company Name                            '
SMBL    ='Stock Ticker Symbol                     '
FYR     ='Fiscal Year End Month of Data           '
YEAR    ='Data Year                               '
AFTNT1  ='Cash and Due from Banks (I1)            '
AFTNT2  ='Total Investment Securities (I8)        '
AFTNT3  ='Loans (Gross) (I23)                     '
AFTNT4  ='Other Deposits (I63)                    '
AFTNT5  ='Total Assets (Gross) (I36)              '
AFTNT6  ='Total Time Deposits (Excl Savings) (I47)'
AFTNT7  ='Total Deposits Worldwide (I53)          '
AFTNT8  ='Total Borrowings (I69)                  '
AFTNT9  ='Reserve-Bad Debt Loss on Loans (I78)    '
AFTNT10 ='Interest and Fees on Loans (I105)       '
AFTNT11 ='Fed Funds Sold&Sec Pur-Agree Resell(I11)'
AFTNT12 ='Interest&Fees-Loans(Restated) (I115)    '
AFTNT13 ='Tot Interest&Divnds on Invesmnts(I137)  '
AFTNT14 ='Total Interest Expenses (I137)          '
AFTNT15 ='Tot Current Operating Revenue (I124)    '
AFTNT16 ='Foreign Loans (I13)                     '
AFTNT17 ='Unearned Discount/Income (I24)          '
AFTNT18 ='Operating Expens-Aggr&Tot Cur(I143-I144)'
AFTNT19 ='Common Shares Used in Calc EPS (I200)   '
AFTNT20 ='Income Taxes-Curr Oper Earnings (I146)  '
AFTNT21 ='Total Curr Operat Rev (Restated) (I171) '
AFTNT22 ='Intrst Incme On Fed Fund Sld-Resll(I106)'
AFTNT23 ='Tot Interest&Depst&Borrowing(I173)      '
AFTNT24 ='Net Curr Oper Earn/Share(I193)          '
AFTNT25 ='Common Shares for Calc Earn/Shar(I196)  '
AFTNT26 ='Net Curr Oper Earnings/Share (I197)     '
AFTNT27 ='Total Interest Expense (Restated) (I175)'
AFTNT28 ='Total Curr Oper Exp (Restated) (I179)   '
AFTNT29 ='Income Taxes-Curr Oper Earnings(I181)   '
AFTNT30 ='Source Document                         '
AFTNT31 ='Net Curr Oper Earn/Share-No Extra(I184) '
AFTNT32 ='Common Shares-Calc Earn/Share(I186)     '
AFTNT33 ='Average Loans (Restated)(I210)          '
AFTNT34 ='Average Assets (Restated) (I225)        '
AFTNT35 ='Average Time&Savngs Dep(I226)           '
AFTNT36 ='Average Book Value (I231)               '
AFTNT37 ='Average Reserve for Bad Debt Loss(I207) '
AFTNT38 ='Interest Income on Fed Fund (I26)       '
AFTNT39 ='Average Loans-Foreign(I152)             '
AFTNT40 ='Average Fed Funds (I154)                '
I1      ='Cash and Due from Banks                 '
I2      ='U.S. Treasury                           '
I3      ='Securites of Other Govt Agencies&Corp   '
I4      ='Due from Banks (Memo Entry)             '
I5      ='Other Securities (Taxable)              '
I6      ='Total Taxable Investment Securities     '
I7      ='Obligations States and Political Subd   '
I8      ='Total Investment Securities             '
I9      ='Geographic Designation Code             '
I10     ='Trading Account Securities              '
I11     ='Fed Funds Sold and Securities Purchased '
I12     ='Treasury Stock-Dollar Amount-Common     '
I13     ='Foreign Loans                           '
I14     ='Real Estate Loans-Total                 '
I15     ='Real Estate Loans-Insrd or Guar by Govt '
I16     ='Treasury Stock-Dollar Amount-Preferred  '
I17     ='Loans to Financial Institutions         '
I18     ='Loans for Purchasing or Carrying Secur  '
I20     ='Commercial or Industrial Loans          '
I21     ='Loans to Indivd for Consumer Expendtr   '
I22     ='Other Loans                             '
I23     ='Loans (Gross)                           '
I24     ='Unearned Discount/Interest              '
I25     ='Interest on Due from Banks(Restated)    '
I26     ='Interest Income on Fed Funds Sold-Resale'
I27     ='Other Interest Income(Restated)         '
I28     ='Bank Premises,Furniture,and Fixtures    '
I29     ='Real Estate Other than Bank Premises    '
I30     ='Investments on Nonconsolidated Subsidry '
I31     ='Direct Lease Financing                  '
I32     ='Customer"s Liability-Bank Accept Outstan'
I33     ='Other Assets                            '
I34     ='Intangible Assets                       '
I35     ='Aggregate Miscellaneous Assets          '
I36     ='Total Assets (Gross)                    '
I37     ='Trading Account Income (Restated)       '
I38     ='Other Current Operating Revenue(Restatd)'
I39     ='Interest Expense On Fed Funds,Etc Repur '
I41     ='Total Demand Deposits                   '
I43     ='Consumer Type Time Deposits             '
I44     ='Total Savings Deposits                  '
I45     ='Money Market Certificates of Deposit    '
I46     ='All Other Time Deposits                 '
I47     ='Total Time Deposits (Other than Savings)'
I49     ='Interest on Long Term Debt-Non Capital  '
I50     ='Interest on Other Borrowed Money        '
I51     ='Other Interest Expense                  '
I52     ='Salaries and Related Expenses           '
I53     ='Total Deposits-Worldwide                '
I54     ='Total Domestic Deposits                 '
I55     ='Total Foreign Deposits                  '
I56     ='Demand Deposits of IPC                  '
I57     ='Time and Savings Deposits of IPC        '
I58     ='Deposits of U.S. Government             '
I59     ='Deposits of States and Political Subdiv '
I60     ='Deposits of Foreign Governments         '
I61     ='Deposits of Commercial Banks            '
I62     ='Certified and Officers" Checks          '
I63     ='Other Deposits                          '
I65     ='Fed Funds Purchased,Etc-Repurchase      '
I66     ='Commercial Paper                        '
I67     ='Long-Term Debt-Non Capital              '
I68     ='Other Liabilities for Borrowed Money    '
I69     ='Total Borrowing                         '
I70     ='Valuation Portion of Res-Loan Losses    '
I71     ='Mortgage Indebtness                     '
I72     ='Acceptances Executed by or for Bank     '
I73     ='Other Liabilities (Excluding Val Res)   '
I74     ='Deferred Portion of Reserves-Loan Losses'
I75     ='Contingency Portion-Reserves-Loan Losses'
I76     ='Total Liabilities(Excl Valuation Reserv)'
I77     ='Minority Interest in Consolidated Subsid'
I78     ='Reserves for Bad Debt Losses on Loans   '
I80     ='Reserves on Securities                  '
I81     ='Total Reserves on Loans and Securities  '
I82     ='Fixed Expenses (Occupancy and Equipment)'
I83     ='Other Current Operating Expense (Restat)'
I84     ='Capital Notes and Debentures            '
I85     ='Minority Interest (Income Account)      '
I86     ='Preferred Stock-Par Value               '
I87     ='Number of Shares of Outstanding Pref Stk'
I88     ='Common Stock-Par Value                  '
I89     ='Number of Shares Authorized             '
I90     ='Number of Shares Outstanding            '
I91     ='Number of Shares Reserves for Conversion'
I92     ='Treasury Stock-Cost                     '
I93     ='Number of Treasury Shares Held          '
I95     ='Surplus                                 '
I96     ='Undivided Profits                       '
I97     ='Reserves-Contingencies&Other Cap Reserve'
I98     ='Total of Extraordinary Items-Net Taxes  '
I99     ='Total Book Value                        '
I100    ='Net Income/Share-Excl Extraordinary Item'
I101    ='Total Liabilies, Reserves,&Cap Accounts '
I102    ='Total Cap Accounts&Minority Interest    '
I103    ='Net Curr Oper Earn/Share-Excl Extra Item'
I104    ='Foreign Exchange Gains and Losses       '
I105    ='Interest and Fees on Loans              '
I106    ='Interest Income on Fed Funds-Resell     '
I108    ='Interest and Discount on US Treasury Sec'
I109    ='Interest-Securities-US Govt Agen&Corp   '
I110    ='Interest&Dividends-Other Taxable Sec    '
I111    ='Total Taxable Investment Revenue        '
I112    ='Interest on Obligations of State&Subdiv '
I113    ='Other Interest Income                   '
I114    ='Trading Account Interest(Memo Entry)    '
I115    ='Total Interest&Dividends on Investments '
I116    ='Aggregate Loan and Inestment Revenues   '
I117    ='Trust Department Income                 '
I118    ='Service Charges on Deposit Accounts     '
I119    ='Other Service Charges and Fees          '
I120    ='Trading Account Income                  '
I121    ='Other Current Operating Revenue         '
I122    ='Interest on Due from Banks              '
I123    ='Aggregate Other Current Operating Revnue'
I124    ='Total Current Operating Revenue         '
I125    ='Number of Employees                     '
I126    ='Salaries&Wages of Officers and Employees'
I127    ='Pension and Eployee Benefits            '
I128    ='Average Fed Funds Purchased-Repurchase  '
I129    ='Interest on Deposits                    '
I130    ='Interest Expense on Fed Funds Pur-Repur '
I131    ='Interest on Other Borrowed Money        '
I132    ='Interest on Long-Term Debt-Non Capital  '
I133    ='Total Interest on Deposit and Borrowings'
I134    ='Interest On Capital Notes and Debentures'
I135    ='Provision for Loan Losses               '
I136    ='Occupancy Expense of Bank Premises-Net  '
I137    ='Total Interest Expense                  '
I138    ='Rental Income                           '
I139    ='Furniture&Equip:Depreciation,Other Cost '
I140    ='Number of Employees (Restated)          '
I141    ='Number of Domestic Officers (Restated)  '
I142    ='Other Current Operating Expense         '
I143    ='Aggregate Other Current Operating Expens'
I144    ='Total Current Operating Expense         '
I145    ='Current Operating Earn before Income Tax'
I146    ='Income Taxes Applicable-Curr Oper Earn  '
I147    ='Net Current Operating Earnings          '
I148    ='Minority Interest (Income Account)      '
I149    ='Net Current Operating Earn-After Min Int'
I150    ='Average Cash and Due from Banks(Restate)'
I151    ='Average Loans-Domestic(Restated)        '
I152    ='Average Loans-Foreign(Restated)         '
I153    ='Net Pre-Tax Profit(Loss)-Sec Sld-Redeem'
I154    ='Average Fed Fund Sold Purch-Resell      '
I155    ='Average Trading Account Securities      '
I156    ='Average Deposits (Restated)             '
I157    ='Tax Effect-Profit(Loss)-Sec Sold-Redeem '
I158    ='Net After-Tax Profit(Loss)-Sec Sold     '
I159    ='Minority Interest-After Tax-Securities  '
I160    ='Net-After Tax and After Minority Int    '
I161    ='Net Income                              '
I162    ='Preferred Dividend Deductions           '
I163    ='Savings Due to Common Stock Equivalents '
I164    ='Net Income Available for Common         '
I165    ='Net Current Operating Earn Avail-Common '
I166    ='Interest and Fees on Loans (Restated)   '
I167    ='Taxable Investment Income (Restated)    '
I168    ='Non-Taxable Investment Income(Restated) '
I169    ='Total Interest Income(Restated)         '
I170    ='Trust Department Income(Restated)       '
I171    ='Total Current Operating Rev(Restated)   '
I172    ='Interest on Deposits (Restated)         '
I173    ='Total Interest on Deposits&Borrowings   '
I174    ='Interest on Capital Notes&Debentures    '
I175    ='Total Interest Expenses                 '
I177    ='Provisions for Loan Losses              '
I178    ='Cash Dividends Declared on Preferred Stk'
I179    ='Total Current Operating Expense(Restate)'
I180    ='Current Operating Earnings-Befre Inc Tax'
I181    ='Inc Tax on Current Operating Earnings   '
I182    ='Net After Tax Interest Profit(Restated) '
I183    ='Net Income (Restated)                   '
I184    ='Net Current Operating Earn/Share(Rstate)'
I185    ='Total Extraordinary Items Net of Taxes  '
I186    ='Common Stock Used in Earn/Share(Rstate) '
I187    ='Addtions to Reserves-Bad Debts-Merge/Abs'
I188    ='Addtions to Reserves-Bad Debts-Recover  '
I189    ='Deduct from Reserv-Bad Debt-Losses      '
I190    ='Net Credit or Charge to Reserves-Loans  '
I191    ='Transfers to Reserves-Undivided Profits '
I192    ='Average Preferred Stock-Par Value(Rstat)'
I193    ='Net Operating Earn/Share-Excl Extra Item'
I194    ='Net Income/Share-Excl Extra Items       '
I195    ='Net Income/Share-Incl Extra Items       '
I196    ='Common Shares Used-Earn/Share           '
I197    ='Net Current Oper Earn/Share-Excl Extra  '
I198    ='Net Income/Share-Excl Extra Items       '
I199    ='Net Income/Share-Incl Exta Items        '
I200    ='Common Shares Used in Fully Diluted E/S '
I201    ='Common Dividends Paid/Share by Ex-Date  '
I202    ='Annualized Dividend Rate                '
I203    ='Market Price-High                       '
I204    ='Market Price-Low                        '
I205    ='Market Price-Close                      '
I206    ='Common Shares Traded                    '
I207    ='Average Reserves for Bad Debts-Loan Loss'
I208    ='Number of Domestic Offices              '
I209    ='Number of Foreign Offices               '
I210    ='Average Loans(Restated)                 '
I211    ='Average Assets(Gross)                   '
I212    ='Average Loans(Gross)                    '
I213    ='Average Cash and Due from Banks         '
I214    ='Average Taxable Investments             '
I215    ='Average Non-Taxable Investments         '
I216    ='Average Deposits                        '
I217    ='Average Deposits-Time and Savings       '
I218    ='Average Deposits-Demand                 '
I219    ='Average Borrowings                      '
I220    ='Average Fed Funds Sold-Resell           '
I221    ='Average Book Value                      '
I222    ='Average Fed Funds-Agreement to Repurch  '
I223    ='Average Taxable Investments(Restated)   '
I224    ='Average Non-Taxable Investments(Rstated)'
I225    ='Average Assets(Restated)                '
I226    ='Average Deposits-Time and Savings(Rstat)'
I227    ='Average Deposits-Demand(Restated)       '
I228    ='Average Deposits-Foreign(Restated)      '
I229    ='Average Borrowings(Restated)            '
I230    ='Average Long-Term Debt(Restated)        '
I231    ='Average Book Value(Restated)            '
I232    ='Adjustment Factor-Cumulative by Ex-Date ';

* these 2 comment lines added by doncram;
* end of fhd.bank.compustat.sas contributed by H. Alan Montgomery. ;