BookmarkSubscribeRSS Feed
Olga239
Calcite | Level 5

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!

 

3 REPLIES 3
GaneshLekurwale
Fluorite | Level 6

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;

 

Olga239
Calcite | Level 5

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.

GaneshLekurwale
Fluorite | Level 6

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 3965 views
  • 0 likes
  • 2 in conversation