Layout SAS-在宏中定义分页符
我想知道在使用宏输出数据时,是否有一种方法可以定义何时何地发生分页符。我知道在各种ODS标记中可以使用“Startpage=NOW”,但如果在该标记集中使用宏,则这似乎不起作用。因此,基本上我希望两个表,每个个人ID代码的图表都在一个单独的页面上,下一页包含相同的汇总图,该个人的图表,等等。目前,我只能将每个表和图表放在自己的单独页面上,这会导致一份冗长的报告!如有任何帮助/建议,将不胜感激Layout SAS-在宏中定义分页符,layout,sas,sas-macro,ods,sas-ods,Layout,Sas,Sas Macro,Ods,Sas Ods,我想知道在使用宏输出数据时,是否有一种方法可以定义何时何地发生分页符。我知道在各种ODS标记中可以使用“Startpage=NOW”,但如果在该标记集中使用宏,则这似乎不起作用。因此,基本上我希望两个表,每个个人ID代码的图表都在一个单独的页面上,下一页包含相同的汇总图,该个人的图表,等等。目前,我只能将每个表和图表放在自己的单独页面上,这会导致一份冗长的报告!如有任何帮助/建议,将不胜感激 /***********************************************
/*************************************************************************/
/* Create a macro variable of all the ID codes */
/* */
/*************************************************************************/
proc sql noprint;
select personal_id
into :varlist separated by ' ' /*Each identifier code in the list is sep. by a single space*/
from provider;
quit;
%let cntlist = &sqlobs; /*Store a count of the number of id codes*/
%put &varlist; /*Print the codes to the log to be sure our list is accurate*/
ods tagsets.rtf file="C:\USER\test.doc" style=sasdocprinter;
/* macro for generating the output table*/
%macro output(x);
proc print data=prov_&x;
run;
proc print data=prov_revCD_&x;
run;
/*Print graph to template defined earlier*/
ods graphics on / height=500px width=500px;
proc sgrender data=summary_&x template=corf_graphs;
run;
ods graphics on / reset=all;
%mend;
%macro loopit(mylist);
%let else=;
%let n = %sysfunc(countw(&mylist)); /*let n=number of codes in the list*/
data
%do I=0 %to &n;
%let val = %scan(&mylist,&I); /*Let val= the ith code in the list*/
%end;
/*Run a loop for each oscar code. Each code will enter the
%do j=0 %to &n;
%let val = %scan(&mylist,&j); /*Let val= the jth code in the list*/
/*Run the macro loop to generate the required tables*/
%runtab(&val);
%output(&val);
%end;
run;
%mend;
%loopit(&varlist)
/*Run the macro loop over the list of significant procedure code values*/
ods tagsets.rtf close;
宏只是源代码生成设备。它们对任何特定技术的有效性都没有影响,除非它们的(错误)使用可能会使我们更难看到如何正确地使用它们 在这种情况下,如果希望
%output()
的每次迭代都在一个页面上,那么只需在%output(&val)
调用之前添加一个开始页面
%runtab(&val);
ods tagsets.rtf startpage=now;
%output(&val);
%end;
这将在输出之前立即生成一条起始页指令。如果您总是希望在调用它之前有一个新页面,那么您可以很容易地将它包含在%输出宏中。我在建议的位置插入了startpage=NOW,它插入了一个空白页面,在对位置进行了调整并查看了代码所做的操作后,以下剪报结束了它的工作:
ods tagsets.rtf startpage=NOW;
%runtab(&val);
%output(&val);
ods tagsets.rtf startpage=no;
%end;
除了使用宏外,还可以考虑使用<代码> Page Buy <代码> >代码> PROC Prime/CODE >为您分页。