data class;
set sashelp.class;
run;
%macro xxxx(lib=,dsn=,vname=);
%let t="%sysfunc(prxchange(s/\s+/" "/,-1,%upcase(&vname)))";
data _null_;
set sashelp.vcolumn(keep=libname memname name type
where=(libname="%upcase(&lib)" and memname="%upcase(&dsn)" and upcase(name) in (&t))) end=last;
if _n_=1 then call execute("data test;set &lib..&dsn;");
if type='num' then call execute(catt('num_',name,'=',name,';'));
else call execute(catt('char_',name,'=',name,';'));
if last then call execute('run;');
run;
%mend;
%xxxx(lib=work,dsn=class,vname=age name sex)
... View more