Hi @sarav93
Here is an approach to achieve this:
data mydata;
input a:$30. b:$30.;
id+1;
datalines;
61,213,625,637,8010 61,625,637,650,8010
61,213,625,650,8010 61,213,637,650,8010
;
data mydata_long;
set mydata;
do i=1 to countw(a,',');
a1 = scan(a,i);
b1 = scan(b,i);
output;
end;
keep a1 b1 id;
run;
proc sql;
create table diff as
(select id, a1 from mydata_long
except
select id, b1 from mydata_long)
union
(select id, b1 from mydata_long
except
select id, a1 from mydata_long);
quit;
data diff2 (keep=id expected);
do until (last.ID);
set diff;
by id;
length expected $50.;
expected = catx(",",expected,a1);
end;
run;
proc sql;
create table want as
select a, b, expected
from mydata as a full join diff2 as b
on a.ID = b.ID;
quit;
Best,
... View more