data one; input name $ score; cards; John 23 Sally 45 ; data two; input name $ score2; cards; John 23 Mary 65 ; proc sql; select * from one, two where one.name=two.name; *displays only matches; select * from one join two on one.name=two.name; *same as above; select * from one left join two on one.name=two.name; *everything in first with matches in second; select * from one right join two on one.name=two.name; *everything in second with matches in first; select * from one full join two on one.name=two.name; *everything in both; select * from one outer join two on one.name=two.name; *does not work; select * from one union join two on one.name=two.name; *does not work; select * from one union join two; *weird, like concatenation but variables offset; select * from one natural join two; *automatically matches on variables that are same; quit;