Hi all! I have the following problem.
I do page breaks in my table using "break after sex / page" construction, but SAS inserts Section breaks(instead of expected Page break) in .rtf output.
It ruins pagination in document, because I need separate pagination for each table (each table in separate section).
Code example is below and I also attached desirable output and actual output (please see it with pressed Show/Hide button).
ods html close;
ods escapechar = '^';
options mprint nofmterr nocenter nonumber nodate missing = ' ';
proc template;
define style MyStyleRTF;
parent = styles.rtf;
replace fonts /
'TitleFont2'=("Arial",8pt)
'TitleFont'=("Arial",8pt)
'StrongFont'=("Arial",8pt)
'EmphasisFont'=("Arial",8pt)
'FixedEmphasisFont'=("Arial",8pt)
'FixedStrongFont'=("Arial",8pt)
'FixedHeadingFont'=("Arial",8pt)
'FixedFont'=("Arial",8pt)
'headingEmphasisFont'=("Arial",8pt)
'headingFont'=("Arial",8pt)
'docFont'=("Arial",8pt)
'BatchFixedFont'=("Arial",8pt);
replace color_list /
'link'= blue
'bgH' = white
'fg' = black
'bg' = white;
class header, footer /
backgroundcolor = white
fontfamily = "Arial"
color = black;
style body from body /
leftmargin = .7in
rightmargin = .7in
topmargin = 1.0in
bottommargin = 0.7in;
replace Table from Output /
frame = above
rules = groups
cellpadding = 0pt
cellspacing = 0pt
borderwidth = 0.8pt;
end;
run;
quit;
ods rtf file = "Actual_result.rtf" style = MyStyleRTF;
options orientation = landscape;
ods startpage = yes;
title1 j = r '{Page \field{\*\fldinst { PAGE \\* MERGEFORMAT }}} of {\field{\*\fldinst SECTIONPAGES \* MERGEFORMAT }}';
ods rtf sectiondata="\pgnrestart\pgnstarts1";
proc report data = sashelp.class;
define sex / order;
break after sex / page;
run;
ods rtf close;
Thank you in advance!
Please try below code after your PROC TEMPLATE . I edited your code by commenting and replacing with few changes.
ods rtf file = "Actual_result.rtf" style = MyStyleRTF;
options orientation = landscape;
/*ods startpage = yes; */
/*title1 j = r '{Page \field{\*\fldinst { PAGE \\* MERGEFORMAT }}} of {\field{\*\fldinst SECTIONPAGES \* MERGEFORMAT }}';*/
title1 j = r '{Page \field {\*\fldinst PAGE \\*MERGEFORMAT}} {of \field {\*\fldinst NUMPAGES \\*MERGEFORMAT}}';
/*ods rtf sectiondata="\pgnrestart\pgnstarts1";*/
proc report data = sashelp.class;
define sex / order;
break after sex / page;
run;
ods rtf close;
Yes, it works when there is only one table in the document (as in my simplest example).
But unfortunately when we have several tables pagination retains consecutive.
I am not really sure about what exactly you mean "But unfortunately when we have several tables pagination retains consecutive." I have produced enough reports with the same code and had never been problem with several hundred pages. May be you can elaborate more I am sure there is solution to your case.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.