- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi
Thanks for your time.
I have an issues, where group variable is splitting into two pages when I use proc report (ods RTF). I was wondering is there way to keep group variable in the same page.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi:
It is hard to visualize what you mean when you say that your "group variable is splitting into two pages" -- do you mean your group is too long (and has too many observations to fit on one page such as with the example #1 below) or that your group is too wide (and has too many variables to fit on one page, such as with example #2 below). Can you post the PROC REPORT code you're using and some of the data or post a screen shot of what you mean?
Remember that with RTF output, the boundaries of the physical page will impact the output, as well as the font size and other presentation elements of your report.
Cynthia
ods rtf file='c:\temp\too_long.rtf';
** Sedan is too "long" to fit on one page;
** but Hybrid will fit on one page;
proc report data=sashelp.cars nowd;
title 'Example 1: Too Long';
title2 'Hybrid will "fit" but Sedan will not "fit" on 1 page';
where type = 'Sedan' or type='Hybrid';
column type make model msrp;
define type / order;
define make / order;
define model / order;
break after type / page;
run;
ods rtf close;
ods rtf file='c:\temp\too_wide.rtf';
** only need one type for a too wide report;
proc report data=sashelp.cars nowd;
title 'Example 2: Too Wide';
column type make model origin drivetrain msrp invoice enginesize
cylinders horsepower mpg_city mpg_highway
weight wheelbase length;
where type='Wagon';
define type / order;
break after type / page;
run;
ods rtf close;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the reply.
I used the your example 1 code with minor modification. Please see below image, where 'Chrysler' is splitted into two pages. I wanted to print entire 'Chrysler' should be in page 1 or page 2. Page 2 is more appropriate.
ods rtf file='C:\Users\sk279\Desktop\test\too_long.rtf';
** Sedan is too "long" to fit on one page;
** but Hybrid will fit on one page;
proc report data=sashelp.cars nowd;
title 'Example 1: Too Long';
title2 'Hybrid will "fit" but Sedan will not "fit" on 1 page';
where type = 'Sedan' or type='Hybrid';
column type make model msrp;
define type / order noprint;
define make / order;
define model / order;
break after type / skip;
compute after type ;
line '';
endcomp;
compute after make ;
line '';
endcomp;
run;
ods rtf close;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi:
I see a few issues with your version of the code. First, SKIP is not appropriate for RTF -- it will be ignored. Next, even though you have MAKE as an ORDER item, you have TYPE as the PRIMARY order item. So even with TYPE as NOPRINT, you have not told PROC REPORT that you even want MAKE to be kept together. Have you investigated using the PAGE option, as I showed in my original code, which in my example, forces each TYPE to start on a separate page? You might instead use BREAK AFTER MAKE/PAGE;
Frequently, for issues like this, if you add the SPANROWS option to your PROC REPORT statement, spanning the rows, sometimes causes breaking to happen the way you want. For example, when I use SPANROWS on your example code, people create their own "fake" page breaking variable and do page breaking on the "fake" variable. There have been many postings about this. Or, you may want to investigate TAGSETS.RTF, which has different page breaking algorithms that it uses (and automatically puts the word "Continued" when a table breaks across pages).
However, in SAS 9.4, when I just modify your code to use SPANROWS, I get the output shown in the attached screen shot.
Cynthia
ods rtf file='C:\temp\sk279_too_long_spanrows.rtf';
** Sedan is too "long" to fit on one page;
** but Hybrid will fit on one page;
proc report data=sashelp.cars nowd spanrows;
title 'Example 1: Too Long';
title2 'Hybrid will "fit" but Sedan will not "fit" on 1 page';
where type = 'Sedan' ;
column type make model msrp;
define type / order noprint;
define make / order;
define model / order;
break after type / skip;
compute after type ;
line '';
endcomp;
compute after make ;
line '';
endcomp;
run;
ods _all_ close;