The SAS Output Delivery System and reporting techniques

ODS RTF and Proc Report Page Breaking

Occasional Contributor
Posts: 9

ODS RTF and Proc Report Page Breaking


I'm having some issues with ODS RTF and Proc Report.

I'm OK with my presentation of the data (font size, margins, cell width and everything), and do not want all my columns crammed onto one page, I actually need them to span two (and only two) pages.

I want to have the page wrap to be sequential (since the columns are also for dozens of observations).

Instead of having everything from page one being listed, and then everything from page two being listed, ie:

Page 1 of 2

Page 1 of 2

Page 1 of 2

Page 2 of 2

Page 2 of 2

Page 2 of 2

I'm looking for a display like this:

Page 1 of 2

Page 2 of 2

Page 1 of 2

Page 2 of 2

Page 1 of 2

Page 2 of 2

Is there a way to force the rtf output to be presented in the latter way?

Hopefully that makes some sense.

Here is the code I am using for the reporting portion.

ods rtf file="path\filename.rtf";

proc report data=clinout nowd split='|' headline headskip spacing=1 missing spanrows style(header)={background=white};

  column V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13 V14 V16 V17 ;

  define V1/ 'label 1' flow left group id order=data style(column)={width=8%} width=10;

  define V2/ 'label 2' flow left width=9  style(column)={width=10%};

  define V3/ 'label 3' flow left width=9  style(column)={width=10%};

  define V4/ 'label 4' flow left width=9 style(column)={width=10%};

  define V5/ 'label 5' flow left width=9  style(column)={width=10%};

  define V6/ 'label 6' flow width=9 style(column)={width=10%};

  define V7/ 'label 7' flow left width= 9 style(column)={width=10%} ;

  define V8/ 'label 8'   left flow width=9 style(column)={width=10%};

  define V9/ 'label 9'   left flow width=9 style(column)={width=10%} ;

  define V10/ 'label 10' flow left width=10 style(column)={width=10%} ;

  define V11/ 'label 11' flow left width=10 style(column)={width=10%};

  define V12/ 'label 12' flow left width=10 style(column)={width=10%};

  define V13/ 'label 13' flow width=10 style(column)={width=15%};

  define V14/ 'label 14' flow width=10 style(column)={width=10%};

  define V15/ 'label 15' flow width=10 style(column)={width=10%};

  define V16/ 'label 16' flow left width=10 style(column)={width=25%};

  define V17/ 'label 17' flow left width=10 style(column)={width=10%};


ods rtf close;

Thanks in advance for your help!

Posts: 9,325

Re: ODS RTF and Proc Report Page Breaking

Hi: The HEADLINE, HEADSKIP, SPACEING= FLOW and WIDTH= options are LISTING only options and they will NOT be used by your ODS RTF output (or PDF or HTML). Using the STYLE= option for WIDTH= is a good technique to make the columns smaller, but a better way would be to specify physical sizes, such as .75 in or 1.5 in instead of percentages. When you use percentages, you are making ODS work to 1) convert the percentages to physical sizes and then 2) convert the physical sizes to TWIPS for RTF. RTF is limited to the physical amount of space on the page. So if you need to "shrink" the report so it fits on one page, then you need to alter the code.

  You indicated that you had "some issues" with PROC REPORT, but don't say what those issues are. It seems likely to me that you are having "issues" with fitting the report on one page, horizontally, so that V1-V17 are on one page. Have you tried changing the orientation to landscape? If you run this program, you will see that the 25 observations did not fit in the horizontal space until the font was either 6 pt or 4pt. You will also notice that at larger font sizes, the CELLWIDTH=/WIDTH= option for VW1 caused wrapping to occur automatically in the Word Processor (without using the FLOW option). Notice that I have made only 3 changes: FontSize, Cellpadding and width for VW1. The biggest impace comes from altering the FONTSIZE and changing the orientation.


** 1) look at some examples of very wide reports;
** first, make some data;
data verywide;
array vw $40 vw1-vw25;
do grp = 'wombat', 'ocelot', 'koala';
  if grp = 'ocelot' then do;
       vw{1} = 'long string gg gggg ggg ggg ggg ggggg gg';
  else do;
       vw{1} = 'pppppppppp';
  do i = 2 to 25 by 1;
    if i le 12 then vw{i} = 'aaaaaaa'||put(i,z3.0);
    else if i gt 12 then vw{i} = 'xxxxxxx'||put(i,z3.0);
  output verywide;
  output verywide;
  output verywide;
** next, set up a macro to create report with for each time different fonts;

** and change the width for VW1 column explicitly;
%macro smfont(fs=8pt);
title; footnote;
%let ttl2 = Note diff between RTF and HTML;
proc report data=verywide nowd
   style(report)={font_face='Arial Narrow'
                  font_size=&fs cellpadding=2px}
   style(header)={font_face='Arial Narrow' font_size=&fs}
   style(column)={font_face='Arial Narrow' font_size=&fs};
title "very wide report at font_size=&fs";
title2 "&ttl2";
column grp vw1-vw25;
define grp/order id;
define vw1 / display style(column)={width=1.0in};

** finally, use the macro and set orientation for;
** rtf and pdf;
** change the font 5 different times.;
** orientation has no effect on HTML;
options nodate nonumber orientation=landscape;
ods html file='c:\temp\vw.html' style=sasweb;
ods rtf file='c:\temp\vw.rtf';
ods pdf file='c:\temp\vw.pdf';
title; footnote;
ods _all_ close;

Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation