03-06-2013 11:49 AM
data x(index =(id));
where (code1 in ('1','2','3','4','5','6','7','8')) and code2 in ('12');
keep c1id c2 ..... c2000;/* ... is hard coded columns c3 to c1999*/
create table w1 as
index on x.id ;
like above created tables w1 to w400 by changing left join tables t1 to t400
now merged all the tables w1 through w400 all by id.
merge w1 to w400;
Q) tested the code fine and working for one id. But when running this code for 2 million id's it is taking longer time.
any suggestions to work this code faster?
03-07-2013 08:07 AM
based on your existing SAS Code, you can join all the datasets in one Proc Sql step rather than merging the datasets in data step...
create table final as
select 'variable you want'
from x left join
x.id=t1.id left join
x.id = t2.id left join
x.id = t3.id left join
x.id = t4.id
follow this process in %DO Iterative loop in Macro.....so that you dont need to write join conditions...
Just let me know if you are getting any error in using this logic in %DO Loop in Macro...