我有几个宏变量。例如,
%let var1 = GOOD;
%let var2 = BETTER;
%let var3 = BEST;
我想要做的是使用这些宏变量(如
)创建数据集数据集名称:得分 变量名:var
Obs var
1 GOOD
2 BETTER
3 BEST
答案 0 :(得分:0)
试试这个:
data want;
format var $12.;
var = "&var1";
output;
var="&var2";
output;
var="&var3";
output;
run;
proc print data=want;
run;
答案 1 :(得分:0)
如果您有命名约定,可以查询sashelp.vmacro表:
data _null_;
set sashelp.class;
call symput('name'||put(_n_, 2. -l), name);
run;
%put &name1.;
%put &name19.;
proc sql;
create table want as
select name, value
from sashelp.vmacro
where substr(name, 1, 4)='NAME';
quit;