A Data Step Approach. For each ID, concatenate all variables into a LIST, for this purpose, confYear can be read as a string. Do this with one data set. Then read the other data set and make a concatenated LIST for each observation. For the given ID, check the LIST obtained in the previous data set. If the two are not equal, then output the record. I use a string array to hold the LIST, the array is referenced by the ID as Index of the array. The progam can me made dynamic by getting the number of IDs and the total string-lengths of all variables prior to the data step and fill these in the appropriate statements. I am getting records 3, 7 and 8 against the reported 3 and 8. If I have missed something, let me know. DATA SasConf;
INFILE DATALINES;
INPUT ID ConfName :$9. ConfYear $4. ConfCity &$15. ConfST $ ;
DATALINES4;
1 SUGI 2006 San Francisco CA
2 PHARMASUG 2006 Bonita Springs FL
3 NESUG 2006 newyork NY
4 WUSS 2006 Irvine CA
5 SESUG 2006 Atlanta GA
6 SCSUG 2006 Irving TX
7 MWSUG 2006 Dearborn MI
8 SUGI 2007 Orlando FL
;;;;
run;
DATA SasConf2;
INFILE DATALINES;
INPUT ID ConfName :$9. ConfYear $4. ConfCity &$15. ConfST $ ;
DATALINES4;
1 SUGI 2006 San Francisco CA
2 PHARMASUG 2006 Bonita Springs FL
3 NESUG 2006 Philadelphia PA
4 WUSS 2006 Irvine CA
5 SESUG 2006 Atlanta GA
6 SCSUG 2006 Irving TX
7 PNWSUG 2006 Seaside OR
8 NESUGI 2007 Orlando FL
;;;;
run;
data want;
if _n_ = 1 then do;
array k[8] $35 _temporary_ ;
length list $35;
do j = 1 by 1 until(eof);
set sasconf2 end = eof;
array vars ConfName -- ConfST;
do i = 1 to dim(vars);
call catx('|', list, trim(vars[i]));
end;
k[j] = list;
call missing(list);
end;
end;
set sasconf;
call missing(list);
do i = 1 to dim(vars);
call catx('|', list, trim(vars[i]));
end;
if k[id] ^= list then output;
drop list i j;
run;
proc print data = want;
run;
... View more