For the first part, if you're joining by id, then its pretty straightforward depending on which table (if any) would be the "master" table. If neither, then you might consider: proc sql; create table want as select coalesce(t1,id, t2.id) as ID, coalesce(t1.a,0) + coalesce(t2.a,0) as a from dataset1 t1 full outer join dataset2 t2 on t1.id=t2.id; quit; you will have some issues if id is not unique in either table. For the second part (without testing): proc sql; create table want as select t1.* from ( (select * from sql.a except select * from sql.b) union (Select * from sql.b except select * from sql.a) ) t1; quit;
... View more