Dear All
Suppose I have following codes:
data test;
input ID Var1;
cards;
1 1
2 2
3 3
;
run;
data test2;
input IDX Var100;
cards;
100 100
200 200
400 400
;
run;
PROC SQL;
CREATE TABLE Combined AS
SELECT u1.*,
u2.*
FROM test as u1 FULL JOIN test2 as u2
ON u1.ID = (u2.IDX)/100
;
QUIT;
The created data set Combined look like:
ID Var1 IDX VAR100
1 1 100 100
2 2 200 200
3 3 . .
. . 400 400
Now I want to careate one more Variable, Say Var999 that tells whether the combined data contains data from both dataset test and dataset test2 so that the created data set Combined will look like:
ID Var1 IDX VAR100 Var999
1 1 100 100 1
2 2 200 200 1
3 3 . . 0
. . 400 400 0
Can someone tell me how to do it?