OK. You didn't offer me a sample data to test, so I make it on my own . Hope help you a little bit.
data have;
array x{*} Ar_Accession1 - Ar_Accession12 ;
array y{*} Ar_ExamCode1 - Ar_ExamCode12;
array z{*} $ Ar_ReasonCode1 - Ar_ReasonCode12;
do n=1 to 100;
do i=1 to 12;
x{i}=1;y{i}=2;z{i}='x';
end;
output;
end;
drop n i;
run;
proc sql;
select name into : list separated by ' '
from dictionary.columns
where libname='WORK' and memname='HAVE'
order by input(compress(name,,'kd'),best8.),name;
quit;
data want;
retain &list ;
set have;
run;
Xia Keshan
... View more