I don't think so. Cartesian Product of Data step can't compete SQL's at all. Yours is very very slowly . data a;
infile cards truncover ;
informat id $20.
date mmddyy10.
code $50.;
input id date code;
format date mmddyy10.;
cards;
19075F106 4/29/2014 a10,axau10,a1010,axau1010
6219640 4/29/2014 n10,v10,x10,w10,n1010,v1010,x1010,w1010
6366007 4/29/2014 s10,v10,s1010,v1010
B63FY34 4/29/2014 a10,axau10,a1010,axau1010
25179M103 4/29/2014 a10,axau10,a1010,axau1010
;
data B;
infile cards truncover ;
informat date mmddyy10. code $8.;
input date code;
format date mmddyy10.;
cards;
4/29/2014 a10
4/29/2014 a10
4/29/2014 a10
4/29/2014 x1010
4/29/2014 w10
;
proc sort data=b out=bb nodupkey;by date code;run;
proc sql;
create table temp as
select a.*,bb.code as new_code
from a,bb
where a.date=bb.date and a.code contains strip(bb.code)
order by id,date,code;
quit;
data want;
set temp;
by id date code;
length _code $ 40;
retain _code;
_code=catx(',',_code,new_code);
if last.code then do;output;call missing(_code);end;
drop new_code;
run;
Xia Keshan
... View more