Hello: I tried to combine multiple tables using loop, say i have 20 tables: t20, t19, t18, ......for each year. So far, I have tried join or union from proc sql, but don't know how to do it. Maybe data step, but don't know how. Here are the details about the tables: Each table has a common "id" field and two other variables. e.g. tables look like T20: T19: T18: T17 ................................... id a20 b20 id a19 b19 id a18 b18 ........................................ id1 0 0 id1 1 0 id4 1 1 ....................................... id2 0 1 id4 0 0 id5 0 0 id3 1 1 I would like to combine them together to have first column as "id", it will contain all the ids appearing in all the tables. Then, all the "a" and "b" variables will be after the "id". If certain "id" were not in certain year, the result table will be a missing value. The result table look like: id a20 b20 a19 b19 a18 b18 ....... id1 0 0 1 0 . . id2 0 1 . . . . id3 1 1 . . . . id4 . . 0 0 1 1 id5 . . . . 0 0 I have put some code to create 3 tables as examples to start. Thanks for any help! data t20;
input id $ a20 b20;
cards;
id1 0 0
id2 0 1
id3 1 1
;
run;
data t19;
input id $ a19 b19;
cards;
id1 1 0
id4 0 0
;
run;
data t18;
input id $ a18 b18;
cards;
id4 1 1
id5 0 0
;
run;
... View more