DATA TEST201704;
INPUT ID $;
DATALINES;
110
111
112
113
114
115
116
117
;
RUN;
DATA TEST201703;
INPUT ID $;
DATALINES;
110
111
112
;
RUN;
PROC SQL;
CREATE TABLE TESTING AS SELECT *,
CASE WHEN ID IN (SELECT ID FROM TEST201703) THEN 0 ELSE 1 END AS EXIST
FROM TEST201704;
QUIT;
The above proc sql codes is working fine. As the TEST dataset is not available in every period, it could have no data on some period, e.g. 201702. if I run the below codes, there will be an error message read "ERROR: File WORK.TEST201702.DATA does not exist."
My question is: May i know how to set the EXIST key to 1 in TESTING data if the previous period of TEST data (TEST201702) not available? Thanks.
PROC SQL;
CREATE TABLE TESTING AS SELECT *,
CASE WHEN ID IN (SELECT ID FROM TEST201702) THEN 0 ELSE 1 END AS EXIST
FROM TEST201703;
QUIT;