If I understand you, is this what you are after, a comparison: data WORK.TEST1; infile datalines dsd truncover; input CUSIP:$8. fe:32. yymm_a:YYMMN6.; format yymm_a YYMMN6.; label CUSIP="CUSIP/SEDOL" fe="Mean Estimate"; datalines4; 00036020,0.06,199201 00036020,0.06,199201 00036020,0.06,199201 00036020,0.07,199201 00036110,0.91,199705 00036110,1.24,199705 00036110,1.47,199705 00036110,1.73,199705 00036110,1.55,199705 00036110,1.61,199705 00036110,1.54,199705 00036110,1.25,199705 00036110,1.19,199705 00036110,1.65,199705 00036110,1.71,199705 00036110,1.24,199705 00036110,1.46,199705 00036110,1.47,199810 00036110,1.04,199810 00036110,1.73,199810 ;;;; data WORK.TEST2; infile datalines dsd truncover; input CUSIP:$8. fe:32. yymm_a:YYMMN6.; format yymm_a YYMMN6.; label CUSIP="CUSIP/SEDOL" fe="Mean Estimate"; datalines4; 00036020,0.09,199801 00036020,0.05,199801 00036020,0.03,199801 00036020,0.03,199801 00036020,0.07,199801 00036020,0.03,199801 00036020,0.06,199801 00036020,0.03,199801 00036020,0.04,199801 00036110,0.88,199705 00036110,0.46,199705 00036110,0.57,199705 00036110,0.47,199705 00036110,0.91,199705 00036110,0.93,199705 00036110,0.41,199705 00036110,0.65,199705 00036110,0.51,199705 00036110,0.47,199705 00036110,0.88,199810 ;;;; proc sort data=test1 nodupkey; by cusip yymm_a; run; proc sort data=test2 nodupkey; by cusip yymm_a; run; data exist_only_test1 exist_only_test2 exist_test1_test2 ; merge test1(in=a) test2(in=b ); by cusip yymm_a; if a and b then output exist_test1_test2; else if a and not b then output exist_only_test1; else if b and not a then output exist_only_test2; run;
... View more