data want;
set hh.test;
array x1{*} $ net1-net7 ;
array x2{*} count1-count7;
array x3{*} allow1-allow7;
array y1{*} $ 80 _net1-_net7 ;
array y2{*} _count1-_count7 ;
array y3{*} _allow1-_allow7;
n1=dim(x1)+1; n2=dim(x2)+1; n3=dim(x3)+1;
do i=dim(x1) to 1 by -1;
if not missing(x1{i}) then do;
n1+(-1);y1{n1}=x1{i};
end;
end;
do j=dim(x2) to 1 by -1;
if not missing(x2{j}) then do;
n2+(-1);y2{n2}=x2{j};
end;
end;
do k=dim(x3) to 1 by -1;
if not missing(x3{k}) then do;
n3+(-1);y3{n3}=x3{k};
end;
end;
drop i j k n1 n2 n3 net1-net7 count1-count7 allow1-allow7;
run;
proc export data=want
outfile="c:\want.xlsx" replace
dbms=excel;
run;
... View more