不需要用数组:
proc contents data=a1 out=cont noprint; run;
proc sql noprint;
select compress(name||'='||'_'||name) into: renames separated by' '
from cont
where type=1 ;
select compress(name||'=strip(put(_'||name||", $12.));")into: tochar separated by' '
from cont
where type=1 ;
quit;
%put "content: &tochar";
data a_new;
set a1 (rename=(&renames.));
&tochar;
drop _: ;
run;