各位大牛,我现在想用循环语句实现tagset.excelxp将多个表格插入同一个excel。可结果不对,循环后只有最后一个表插入了,其他的都没有了。想请教各位tageset.excelxp能嵌套到循环里面使用么?还是我的程序写的有问题呢?下面是我的程序。
data ods;
set dictionary_table;
keep memname;
where upcase(substr(memname,1,6))="ERROR_";
proc print data=ods;run;
%macro cc(ods=);
data _null_; set &ods;call symput("num_var",_n_);run;
%put &num_var;
%do i=1 %to %eval(&num_var);
data _null_;
set &ods;
if _n_=&i.;
call symput('dsn',trim(memname));
%put &dsn;
run;
ods tagsets.excelxp file="C:\Documents and Settings\Administrator\桌面\x.xls"
/*options(sheet_name="sheet&i.")*/ style=analysis;
proc print data=error20161101;run;
ods tagsets.excelxp ;
proc print data=&dsn;run;
ods tagsets.excelxp close;
dm 'output;close';
%end;
%mend cc;
%cc(ods=ods)