[英]SAS Proc Report Title Error
我有一個問題,其中通過do循環創建我的報告,但是列出宏的標題頁每次都無法反映正確的命名約定。 它適用於PDF中的每個書簽以及proc報告本身。 但是,標題無法正確反映。
%macro PDF_T2(year=, age= );
proc sql noprint;
select distinct region, bh_type
into :region1 - :region14, :bh_type1 - :bh_type14
from table2_IP
;
quit;
/*%put ®ion1 ®ion2;*/
/*%put &bh_type1 &bh_type2;*/
ods escapechar '^';
ods pdf file="C:\PDFS\Table2.pdf" pdftoc=2 style=Custom;
options orientation=landscape missing=' '
topmargin=.25in
bottommargin=.25in
leftmargin=.25in rightmargin=.25in ;
ods proclabel " Inpatient Analysis By Plan ";
%do i=1 %to 4;
TITLE "^{style [JUST= C ]Table 2. Inpatient Utilization By Plan,}";
TITLE2 "^{style [JUST= C ]&®ion&i. }" ;
Title3 "^{style [JUST= C ]Adult (21 to 64)}";
Title4 "^{style [JUST= C ]&&bh_type&i. Analysis}" ;
PROC REPORT DATA = Table2_IP contents="&&bh_type&i. Table: Inpatient`enter code here`
我會嘗試確保您使用的是%local宏變量。 如果全局宏變量在周圍浮動,可能會導致一些令人驚訝的結果。
我還將打開MPRINT並查看日志以查看正在生成什么代碼。 它將顯示宏正在生成的TITLE語句。
標題不會自動清除,但是每次執行TITLE語句時,都會清除所有現有標題。
我對您的代碼做了一些修改以在sashelp.prdsale上工作,這看起來還不錯:
%macro titletest(dummy);
%local i region1 region2;
proc sql noprint;
select distinct region
into :region1 - :region2
from sashelp.prdsale
;
quit;
%put region1=®ion1 region2=®ion2;
%do i=1 %to 2;
title1 "Results for &®ion&i";
proc print data=sashelp.prdsale;
where region="&®ion&i";
run;
title1;
%end;
%mend;
options mprint;
%titletest()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.