BookmarkSubscribeRSS Feed
Kastchei
Pyrite | Level 9
When using PROC REPORT with ODS PDF, is there an option to keep groups together, where possible on one page?

For instance, if I have a group with 10 rows, and it starts two rows from the bottom, I would like it to no print any of that group on the first page and instead start a fresh page for the group.

I've done this manually before by creating a noprint dummy variable to use 'break / page' with, but I am looking for a builtin method so that I don't have to massage the data each time I do this.

Thanks,
Michael
1 REPLY 1
Cynthia_sas
Diamond | Level 26
Hi:
With the BREAK statement (to be used with an ORDER or GROUP item), you can use the PAGE option. That will ensure that every group starts on its own page.

For example, see the program below. There may be times when you need to set a dummy variable for page breaking. I find I usually need to do that when there's some arbitrary order or page breaking that I want to impose on a report. If you want to get the page breaking without the summary line, you'd could use this BREAK statement:
[pre]
BREAK AFTER REGION / PAGE;[/pre]

cynthia

options nodate number orientation=portrait;
ods listing close;

ods pdf file='c:\temp\Asia_Canada.pdf';

proc report data=sashelp.shoes nowd;
where region in ('Asia', 'Canada');
column region product subsidiary sales;
define region / group;
define product / group;
define subsidiary / order;
define sales /sum;
break after region / summarize page;
run;

ods pdf close;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1 reply
  • 1815 views
  • 0 likes
  • 2 in conversation