/* demo data set*/
data a;
length a $ 9;
length b $ 10;
a="a9" ;
b="b10";
run;
data b;
length a $ 10;
length b $ 11;
a="a10";
b="b11";
run;
/*get the tmp data set*/
proc sql;
create table _tmp as
select name ,max(length) as length
from sashelp.vcolumn
where libname=upcase("WORK") and memtype="DATA" and type='char'
group by name;
quit;
/* get the macro var of max lenth of every variable*/
proc sql;
select catx(' ' , name,'$ ', length) into :lenlist separated by ' '
from _tmp;
quit;
/ *check it*/
%put &lenlist;
/* append the data*/
data c;
length &lenlist;
set a b;
run;


雷达卡




京公网安备 11010802022788号







