/* These are the same data sets we saw before with a couple */ /* records added to both */ data a; input x y z; datalines; 1 3 7 2 4 8 1 4 10 3 3 . 2 1 6 2 2 . ; run; data b; input x y zz; datalines; 1 3 9 3 4 6 3 3 . 2 4 . 2 2 7 1 1 9 ; run; proc sort data=a; by x y; proc sort data=b; by x y; run; /* Note that from_a and from_b aren't saved */ data dd; merge a (in=from_a) b (in=from_b); by x y; if from_a=1; proc print data=a; proc print data=b; /* The unmatched x,y pairs in b--(1,1) and (3,4) are not included in dd */ proc print data=dd; title 'Data with x,y pair in a'; run; /* Save the data set indicators */ data dd; merge a (in=from_a) b (in=from_b); by x y; save_a=from_a; save_b=from_b; proc print; run;