ODS and Base Reporting

Build reports by using ODS to create HTML, PDF, RTF, Excel, text reports and more!
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-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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