2016-02-12 133 views
1

我正在尋找使ODS PDF中的每個proc報告在PDF書籤的第三級具有其自己的指定標題。我怎樣才能實現這個概念?例如,在下面的圖片中,我想將「表格1」條目更改爲其他文本。Proc Report書籤ODS中的標題PDF

enter image description here

我的代碼如下:

ods escapechar '^'; 
ods pdf file='S:\Restricted\CITER-ER\BHO Phase II\Transition Monitoring\2. Service Utilization\2. Production\SAS codes\Tinkler\PDF Project\SAS REPORTS PDF\PDFS\table2.pdf' style=Custom; 

TITLE "^{style [JUST= C ]Table 2. Names , 2014}"; 
TITLE2 "^{style [JUST= C ]State}" ; 
Title3 "^{style [JUST= C ]Adult (21 to 64)}"; 
Title4 "^{style [JUST= C ] Analysis}" ; 
options orientation=landscape nocenter 
topmargin=.25in 
bottommargin=.25in 
leftmargin=.25in rightmargin=.25in ; 
ods proclabel "IP"; 
PROC REPORT DATA = Table2x 
    style(report)={font_size=9pt cellpadding=2pt cellspacing=.15pt} 
    style(header)={background=VLIG foreground=black font_size = 9pt FONT_WEIGHT = bold just=C } 
    style(column)={font_size=8pt just=C} 
    STYLE(SUMMARY) = {font_weight=bold}; 
    WHERE BH_Type = 'MH' ; 
    COLUMN (
     (' ' P_type ) 
     (' ' P_name) 
     ('MH Inpatient Volume' AID_Type 
     UNIQUSERS N_Episode Admis_Tot Disc_Tot AvgLOS medianLOS LOS_C LOS T_AMT_PAID 
      AvgCostUser  AvgCostEnc)); 
     Define P_Type/ 'MMC Program or Coverage Type' group order=data  style(column)= { cellwidth=20mm just=L } ; 
     Define P_name/ 'Plan Name or Coverage Type'  group order=data  style(column)= { cellwidth=30mm just=L  } ; 
     Define AID_Type/ 'Aid Category'              style(column)= { cellwidth=20mm} ;   
     Define UNIQUSERS/ 'Unique Users'        FORMAT=COMMA12.0 style(column)= { tagattr='format:###,###,##0'  cellwidth=20mm} ; 
     Define N_Episode/ '# of Episodes^{super 1}'      FORMAT=COMMA12. style(column)= { tagattr='format:###,###,##0' cellwidth=20mm} ; 
     Define Admis_Tot / 'Admissions^{super 2}'      FORMAT=COMMA12.  style(column)= { tagattr='format:###,###,##0' cellwidth=20mm} Style(header)={FONT_WEIGHT = bold}  ; 
     Define Disc_Tot / 'Discharges^{super 2}'      FORMAT=COMMA12.  style(column)= { tagattr='format:###,###,##0' cellwidth=20mm}  Style(header)={FONT_WEIGHT = bold}  ; 
     Define LOS_C/ 'Hospital Days^{super X}'  Noprint   FORMAT=COMMA12.  style(column)= { tagattr='format:###,###,##0' cellwidth=15mm} Style(header)={FONT_WEIGHT = bold} ; 
     DEFINE LOS/ 'LOS for discharged^{super 4}'  Noprint   FORMAT=COMMA12.  style(column)= { tagattr='format:###,###,##0' cellwidth=20mm}  Style(header)={FONT_WEIGHT = bold} ; 
     Define T_AMT_PAID / 'Total Amount Paid,$'       FORMAT=DOLLAR14. style(column)= { tagattr='format:$###,###,###' cellwidth=20mm} Style(header)={FONT_WEIGHT = bold} ; 
     Define AVGCOSTUSER / 'Avg Cost Per User, $'     FORMAT=DOLLAR14. style(column)= { tagattr='format:$###,###,###' cellwidth=20mm} ; 
     Define AvgLOS / 'Mean LOS for Discharged Episode'   FORMAT=COMMA12. style(column)= { tagattr='format:###,###,##0' cellwidth=20mm} ; 
     DEFINE MEDIANLOS/ 'Median LOS for Discharged Episode'   FORMAT=COMMA12. style(column)= { tagattr='format:###,###,##0' cellwidth=20mm} ; 
     Define AVGCOSTENC / 'Avg. Cost Per Episode, $'     FORMAT=DOLLAR14. style(column)= { tagattr='format:$###,###,###' cellwidth=20mm} ; 


/* compute P_type;*/ 
/* if P_Type = 'Total' THEN call define(_row_,'style','style={background=VLIP just=R}'); */ 
/**/ 
/* end;*/ 
/* endcomp;*/ 

compute P_type; 
bg + 1; 
if mod(bg, 2) = 1 then 
call define(_row_, "style", "style={background=white}"); 
ELSE call define(_row_, "style", "style={background=#d1e9d1}"); 
IF P_Type = 'Total' THEN call define(_row_,'style','style={background=VLIP just=R}'); 
endcomp; 

RUN; 

/*Need New Title*/ 

PROC REPORT DATA = Table2x 
    STYLE(header) = {background=VLIG foreground=black font_size = 10pt 
        FONT_WEIGHT = bold just=C} 
    STYLE(column) = {font_size = 12pt just=R} 
    STYLE(SUMMARY) = {font_weight=bold}; 
    WHERE BH_Type = 'SUD' ; 
    COLUMN (
     (' ' Year_Month) 
     (' ' P_type ) 
     (' ' P_name) 
     ('SUD Inpatient Volume' AID_Type 
     UNIQUSERS N_Episode Admis_Tot Disc_Tot AvgLOS medianLOS LOS_C LOS T_AMT_PAID 
      AvgCostUser  AvgCostEnc)); 
     DEFINE YEAR_MONTH/ 'YEAR and Month'      style(column)= { cellwidth=20mm just=L } ; 
     Define P_Type/ 'MMC Program or Coverage Type'     style(column)= { cellwidth=20mm just=L } ; 
     Define P_name/ 'Plan Name or Coverage Type'      style(column)= { cellwidth=50mm just=L  } ; 
     Define AID_Type/ 'Aid Category'            style(column)= { cellwidth=20mm} ;   
     Define UNIQUSERS/ 'Unique Users'        FORMAT=COMMA12.0 style(column)= { tagattr='format:###,###,##0'  cellwidth=20mm} ; 
     Define N_Episode/ '# of Episodes~{super 1}'      FORMAT=COMMA12. style(column)= { tagattr='format:###,###,##0' cellwidth=20mm} ; 
     Define Admis_Tot / 'Admissions~{super 2}'      FORMAT=COMMA12. style(column)= { tagattr='format:###,###,##0' cellwidth=20mm} Style(header)={FONT_WEIGHT = bold}  ; 
     Define Disc_Tot / 'Discharges ~{super 2}'     FORMAT=COMMA12. style(column)= { tagattr='format:###,###,##0' cellwidth=20mm}  Style(header)={FONT_WEIGHT = bold}  ; 
     Define LOS_C/ 'Hospital Days~{super X}'  Noprint   FORMAT=COMMA12. style(column)= { tagattr='format:###,###,##0' cellwidth=15mm} Style(header)={FONT_WEIGHT = bold} ; 
     DEFINE LOS/ 'LOS for discharged~{super 4}'  Noprint   FORMAT=COMMA12. style(column)= { tagattr='format:###,###,##0' cellwidth=20mm}  Style(header)={FONT_WEIGHT = bold} ; 
     Define T_AMT_PAID / 'Total Amount Paid,$'       FORMAT=DOLLAR14. style(column)= { tagattr='format:$###,###,###' cellwidth=20mm} Style(header)={FONT_WEIGHT = bold} ; 
     Define AVGCOSTUSER / 'Avg Cost Per User, $'     FORMAT=DOLLAR14. style(column)= { tagattr='format:$###,###,###' cellwidth=20mm} ; 
     Define AvgLOS / 'Mean LOS for Discharged Episode'   FORMAT=COMMA12. style(column)= { tagattr='format:###,###,##0' cellwidth=20mm} ; 
     DEFINE MEDIANLOS/ 'Median LOS for Discharged Episode'   FORMAT=COMMA12. style(column)= { tagattr='format:###,###,##0' cellwidth=20mm} ; 
     Define AVGCOSTENC / 'Avg. Cost Per Episode, $'     FORMAT=DOLLAR14. style(column)= { tagattr='format:$###,###,###' cellwidth=20mm} ; 


compute P_type; 
if P_Type = 'Total' THEN call define(_row_,'style','style={background=VLIP just=R}'); 
endcomp; 

RUN; 












ods pdf close; 
+0

你能給出一個更具體的例子你正在尋找什麼?我不確定你的問題。 – DomPazz

+0

你必須發佈你的代碼。該方法因使用BY組或多個PROC報告或其他方法而異。但是,可以使用Title或ODS TEXT語句。 – Reeza

+0

我在一個ODS PDF輸出中有幾個proc報告。這些報告必須有不同的標題和一些不同的措詞。將Proc報告X和Proc報告Y-Z推送到一個ODS PDF中並使用不同標題很容易嗎? – Tinkinc

回答

1

添加標題是把你想要它的另一個稱號的命令一樣簡單。它只能在proc運行之間進行更改,但在上述情況下,這不是問題。

如果要更改書籤標題,請使用ods proclabel,它也可以在運行之間更新。

如果要更改二級書籤列表,請使用PROC REPORT中的contents選項。

如果要更改第三級書籤列表,請使用define語句中的contentspage選項。

ods pdf file="c:\temp\test.pdf"; 
title "First Run"; 
ods proclabel="Age"; 
proc report data=sashelp.class contents="Table Grouped by Age"; 
    columns age height weight; 
    define age/group contents='Table Grouped by Age' page; 
    define height/analysis mean; 
    define weight/analysis mean; 
run; 

title "Second Run"; 
ods proclabel="Sex"; 
proc report data=sashelp.class contents="Table Grouped by Sex"; 
    columns sex height weight; 
    define sex/group contents='Table Grouped by Sex' page;; 
    define height/analysis mean; 
    define weight/analysis mean; 
run; 

title; 

ods pdf close; 
+0

有沒有一種方法可以在不同的Proc報告中使用不同名稱的PDF標題? – Tinkinc

+0

你將不得不更具體。那是什麼意思?當我運行上面的代碼時,我有2頁,其中一頁帶有一個標題,另一個帶有另一個標題。 – Joe

+0

我上傳了一張命名約定id的圖片,就像在每個Proc報告的ODS PDF中操作一樣。謝謝。 – Tinkinc