data one; input id day month year; datalines; 1 2 12 2003 1 18 12 2003 1 14 4 2004 1 7 5 2004 1 26 5 2004 1 3 6 2004 1 18 6 2004 1 23 6 2004 1 9 7 2004 1 23 7 2004 1 18 8 2004 1 20 8 2004 1 25 8 2004 1 20 9 2004 1 20 10 2004 1 29 10 2004 1 3 11 2004 1 28 11 2004 1 28 11 2004 1 11 12 2004 1 11 12 2004 1 24 12 2004 1 19 1 2005 1 9 2 2005 1 23 2 2005 1 5 5 2005 1 17 5 2005 1 18 5 2005 1 20 6 2005 1 7 7 2005 1 13 7 2005 1 16 8 2005 1 1 9 2005 1 1 9 2005 1 12 9 2005 1 16 9 2005 1 12 10 2005 1 9 11 2005 1 30 11 2005 1 30 11 2005 ; data two; input id day month year; datalines; 1 14 4 2004 1 7 5 2004 1 21 5 2004 1 18 6 2004 1 9 7 2004 1 23 7 2004 1 17 8 2004 1 18 10 2004 1 28 11 2004 1 29 11 2004 1 30 11 2004 1 1 12 2004 1 2 12 2004 1 3 12 2004 1 4 12 2004 1 12 12 2004 1 13 12 2004 1 14 12 2004 1 15 12 2004 ; run; data one_1; set one; newvar=input(catx('/',day,month,year),ddmmyy10.); run; data two_1; set two; newvar1=input(catx('/',day,month,year),ddmmyy10.); run; proc sort one_1;by id year month; run; proc sort two_1;by id year month; run; data merge1; merge one_1(in=a) two_1(in=b); by id year month; if a or b; run; data new; set merge1; daysdifference=put(abs(intck('days',newvar,newvar1)),10.); run; data want; set new; format match $20.; if 0 lt daysdifference le 5 then match='Close Match'; else if daysdifference=0 then match='Perfect Match'; else if daysdifference gt 5 then match='No Match'; if newvar1 = . then match='No match'; run;
... View more