Reputation: 454
I am looking to make each proc report that is within the ODS PDF have its own designated title on the third level of the PDF bookmarks. How can I achieve this concept? For example, in the image below, I'd like to change the "Table 1" entry to some other text.
My code is below:
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;
Upvotes: 1
Views: 1514
Reputation: 63424
Adding a title is as simple as putting another title command where you want it. It can only be changed between proc runs, but in the case above that's not an issue.
If you want to change the bookmark header, you use ods proclabel
, which also can be updated between runs.
If you want to change the second level bookmark listing, you use the contents
option in PROC REPORT
.
If you want to change the third level bookmark listing, you use the contents
and page
option on the define
statement.
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;
Upvotes: 1