sas proc sql joins data merging
data step merge statements corresponding to various joins.
INNER JOIN
merge data1 (in=a) data2 (in=b); by id;
if a and b;
LEFT JOIN
merge data1 (in=a) data2 (in=b); by id;
if a;
RIGHT JOIN
merge data1 (in=a) data2 (in=b); by id;
if b;
FULL JOIN
merge data1 (in=a) data2 (in=b); by id;
[ Quicktips 0206, A Visual Introduction to SQL Joins:, sql workshop at PennPop ]