OK. You almost reached it . It is what you are looking for ? libname x v9 'c:\ ' ;
proc sql;
create table want1 as
select a.*,cats('ind',put(b.sic2,z2.)) as dummy_sic2,cats('ind',put(obs,z2.)) as dummy_obs
from x.spi5 as a left join x.sum5 as b
on a.sic2=b.sic2 ;
quit;
data obs1;
do dummy_obs=1 to 72;
output;
end;
run;
proc sql noprint;
select distinct cats('ind',put(dummy_obs,z2.)) into : list separated by ' ' from obs1;
quit;
data obs2;
set work.want1;
array _y &list ;
do over _y;
_y=ifn(dummy_obs=vname(_y),1,0);
end;
run;
Ksharp
... View more