Macros 宏变量值的SAS长度超过最大长度
嗨,我正试图使用下面的代码为数据集中的每一行调用一个宏Macros 宏变量值的SAS长度超过最大长度,macros,sas,Macros,Sas,嗨,我正试图使用下面的代码为数据集中的每一行调用一个宏 proc sql; select cats('%run_procreg(name=',name,',month=',month,')') into :macrocalllist separated by ' ' from dataset_a; quit; ¯ocalllist; 我得到了“可变最大长度”错误: 宏变量MACROCALLLIST(65540)值的SAS长度 超过最大长度(65534)。该值已被删除 截
proc sql;
select cats('%run_procreg(name=',name,',month=',month,')') into :macrocalllist
separated by ' ' from dataset_a;
quit;
¯ocalllist;
我得到了“可变最大长度”错误:
宏变量MACROCALLLIST(65540)值的SAS长度
超过最大长度(65534)。该值已被删除截断为65534个字符 因为数据集中的行数太多。你能推荐一个工作环境吗
谢谢,调用执行是一种选择。它允许您使用数据集中的数据生成一系列宏调用,而无需将宏调用存储在宏变量中 例如:
%macro testprint(data=,obs=);
proc print data=&data (obs=&obs);
run;
%mend testprint;
data _null_;
input datasetname $13. obs;
call execute('%nrstr(%testprint(data='||datasetname
||',obs='||put(obs,1.)
||'))'
);
cards;
sashelp.shoes 3
sashelp.class 5
;
日志将显示:
NOTE: CALL EXECUTE generated line.
131 ;
1 + %testprint(data=sashelp.shoes,obs=3)
NOTE: There were 3 observations read from the data set SASHELP.SHOES.
2 + %testprint(data=sashelp.class,obs=5)
NOTE: There were 5 observations read from the data set SASHELP.CLASS.
调用执行是一个选项。它允许您使用数据集中的数据生成一系列宏调用,而无需将宏调用存储在宏变量中 例如:
%macro testprint(data=,obs=);
proc print data=&data (obs=&obs);
run;
%mend testprint;
data _null_;
input datasetname $13. obs;
call execute('%nrstr(%testprint(data='||datasetname
||',obs='||put(obs,1.)
||'))'
);
cards;
sashelp.shoes 3
sashelp.class 5
;
日志将显示:
NOTE: CALL EXECUTE generated line.
131 ;
1 + %testprint(data=sashelp.shoes,obs=3)
NOTE: There were 3 observations read from the data set SASHELP.SHOES.
2 + %testprint(data=sashelp.class,obs=5)
NOTE: There were 5 observations read from the data set SASHELP.CLASS.
数据集中有多少行?数据集中有多少行?