« HTML Ampersand Character Codes ascii | Main | OAS measure of yield »

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 ]

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)