forked from lucieluyiliu/WRDS-SAS-UTILITIES
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EXTRACTION&% FISD.sas
45 lines (37 loc) · 1.29 KB
/
EXTRACTION&% FISD.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
LIBNAME CODE "/folders/myshortcuts/SAS";
%INCLUDE "/folders/myshortcuts/SAS/UTILITIES.GENERAL.sas";
LIBNAME FISD "/folders/myshortcuts/WRDS/fisd";
LIBNAME COMPG "/folders/myshortcuts/WRDS/comp.global";
LIBNAME COMPA "/folders/myshortcuts/WRDS/comp.na";
OPTIONS SOURCE NOCENTER LS=80 PS=MAX;
PROC SQL;
CREATE TABLE BANKRUPT AS
SELECT A.ISSUER_ID, A.FILING_DATE, A.FILING_TYPE, B.CUSIP_NAME, C.SIC_CODE,
D.ISSUER_CUSIP
FROM FISD.FISD_BANKRUPTCY AS A, FISD.FISD_ISSUER AS B, FISD.FISD_ISSUER_SIC_CODE AS C,
FISD.FISD_ISSUER_CUSIP AS D
WHERE
A.ISSUER_ID=B.ISSUER_ID AND
A.ISSUER_ID=C.ISSUER_ID AND
A.ISSUER_ID=D.ISSUER_ID AND
C.PRIMARY_SIC = "Y"
ORDER BY A.FILING_DATE DESC
;
RUN;
PROC SQL;
CREATE TABLE BANKRUPT AS
SELECT A.ISSUER_ID, A.FILING_DATE, A.FILING_TYPE, B.CUSIP_NAME, C.SIC_CODE,
D.ISSUER_CUSIP, E.ISSUE_NAME, E.ISIN, E.MATURITY, E.OFFERING_DATE, E.OFFERING_AMT,
F.RATING_TYPE, F.RATING_DATE, F.RATING, F.REASON
FROM FISD.FISD_BANKRUPTCY AS A, FISD.FISD_ISSUER AS B, FISD.FISD_ISSUER_SIC_CODE AS C,
FISD.FISD_ISSUER_CUSIP AS D, FISD.ISSUE_ISSUER AS E, FISD.FISD_RATING_HIST AS F
WHERE
A.ISSUER_ID=B.ISSUER_ID AND
A.ISSUER_ID=C.ISSUER_ID AND
A.ISSUER_ID=D.ISSUER_ID AND
A.ISSUER_ID=E.ISSUER_ID AND
E.ISSUE_ID=F.ISSUE_ID AND
C.PRIMARY_SIC = "Y"
ORDER BY A.FILING_DATE DESC
;
RUN;