To "report all records without missing from either of the datasets", you need a full join and the coalesce function on the joined fields: data a; input pid age Sex $; cards; 1 21 m 1 22 f 1 23 m 2 34 f 2 33 f ; data b; length Drug $16; input pid age Drug $; cards; 1 21 Placebo 1 22 aceclo 2 34 Placebo 2 33 Diclofe 2 34 notavailable 3 27 newDrug ; proc sql; select coalesce(a.pid, b.pid) as Pid, coalesce(a.age, b.age) as Age, a.sex, b.drug from a full join b on a.pid=b.pid and a.age=b.age; quit; In a case like above where the joined fields have the same names in both tables and all non-matching fields have distinct names, you can also use a natural full join and save some typing: proc sql; select * from a natural full join b; quit; Note, I added a non-matching record in table b to show the full effect. PG
... View more