It appears you don't want to merge but to interleave the data sets - but then only keep rows with id's that exist in your first source table.
data have1;
input id y$;
datalines;
1 10
2 20
;
data have2;
input id y$;
datalines;
1 100
1 200
2 300
3 100
4 500
;
data want;
set have1 (in=in1) have2;
by id;
retain keep_id;
if first.id then keep_id=in1;
if keep_id=1;
drop keep_id;
run;
proc print data=want;
run;
... View more