Close, but no cigar Double check your output, especially if you have duplicate X's in any of your datasets. Data Merged_data
Merge dataA(IN=fromdataA)
dataB(IN=fromdataB)
dataC(in=fromdataC)
BY x;
*Create indicator variables to show in which dataset the observation is present;
SourceA=fromdataA;
SourceB=fromdataB;
SourceC=fromdataC;
*keep only from A and B;
if fromdataA AND fromdataB;
run;
... View more