|
Here is the one that will do reasonable fast.
1) The idea is to have the table with all variables a1-a60 + b1-b40 with all values set to '0'.
2) check the observation with n >0
if it is true, calculate the index for a and b to set the corresponding variables to 1, to repeat n times and to output it.
3) reset the updated variables in 2) to '0'
proc import datafile="C:\Downloads\100106170823e2156bd060f7b3.xls"
out=wksht
dbms=Excel replace;
run;
data needs;
array a(*) a1-a60;
array b(*) b1-b40;
retain a1-a60 b1-b40 (100*0);
set wksht;
if n>0 then do;
indexa=input(compress(upcase(x),'A'),best.);
indexb=input(compress(upcase(y),'B'),best.);
do i=1 to n;
a(indexa) =1;
b(indexb) =1;
output;
end;
a(indexa) =0;
b(indexb) =0;
end;
keep a: b:;
run;
|