forked from jcizel/WRDS-SAS-UTILITIES
-
Notifications
You must be signed in to change notification settings - Fork 1
/
#ANALYSIS: AMADEUS.sas#
89 lines (67 loc) · 2.02 KB
/
#ANALYSIS: AMADEUS.sas#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
OPTIONS SASAUTOS=('/wrds/wrdsmacros/', SASAUTOS) MAUTOSOURCE;
%INCLUDE "~/UTILITIES/UTILITIES.GENERAL.sas";
LIBNAME HOME "/scratch/uvanl";
LIBNAME AMA_L "/wrds/bvd/sasdata/ama_l";
LIBNAME AMA_M "/wrds/bvd/sasdata/ama_m";
LIBNAME AMA_S "/wrds/bvd/sasdata/ama_s";
LIBNAME AMA_V "/wrds/bvd/sasdata/ama_v";
OPTIONS SOURCE NOCENTER LS=80 PS=MAX;
PROC DATASETS
LIBRARY = AMA_L
MEMTYPE = DATA
DETAILS;
RUN;
PROC CONTENTS
DATA=AMA_S.COMPANY_S
VARNUM
DETAILS;
RUN;
/*=============================================================================\
| CHECK THE NUMBER OF DISTINCT FIRMS IN THE AMADEUS |
\=============================================================================*/
PROC SQL;
CREATE TABLE AMADEUS_ALLIDS AS
SELECT DISTINCT IDNR, CNTRYCDE, NUMYEARS, LSTATUS FROM AMA_L.COMPANY_L
OUTER UNION CORR
SELECT DISTINCT IDNR, CNTRYCDE, NUMYEARS, LSTATUS FROM AMA_V.COMPANY_V
OUTER UNION CORR
SELECT DISTINCT IDNR, CNTRYCDE, NUMYEARS, LSTATUS FROM AMA_S.COMPANY_S
OUTER UNION CORR
SELECT DISTINCT IDNR, CNTRYCDE, NUMYEARS, LSTATUS FROM AMA_M.COMPANY_M;
QUIT;
PROC SQL;
CREATE TABLE AMADEUS_INACTIVE AS
SELECT *
FROM AMA_L.COMPANY_L AS A
WHERE A.LSTATUS <> "Active"
OUTER UNION CORR
SELECT *
FROM AMA_S.COMPANY_S AS B
WHERE B.LSTATUS <> "Active"
OUTER UNION CORR
SELECT *
FROM AMA_M.COMPANY_M AS C
WHERE C.LSTATUS <> "Active"
OUTER UNION CORR
SELECT *
FROM AMA_V.COMPANY_V AS D
WHERE D.LSTATUS <> "Active";
QUIT;
PROC EXPORT
DBMS=CSV
DATA=AMADEUS_UNACTIVE
OUTFILE="/scratch/uvanl/amadeus.bankrupt.list.csv"
REPLACE;
RUN;
PROC FREQ DATA=AMADEUS_ALLIDS;
TABLES CNTRYCDE NUMYEARS LSTATUS;
RUN;
PROC PRINT DATA=AMADEUS_ALLIDS (OBS=10);
RUN;
PROC PRINT DATA=AMADEUS_UNACTIVE (OBS=10);
RUN;
PROC CONTENTS DATA=AMADEUS_UNACTIVE VARNUM;
RUN;
PROC FREQ DATA=AMADEUS_INACTIVE;
TABLES COUNTRY*LSTATUS;
RUN;