The SAS Output Delivery System and reporting techniques

Keep groups together in REPORT

Reply
Frequent Contributor
Posts: 80

Keep groups together in REPORT

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
SAS Super FREQ
Posts: 8,869

Re: Keep groups together in REPORT

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;
Ask a Question
Discussion stats
  • 1 reply
  • 165 views
  • 0 likes
  • 2 in conversation