Help using Base SAS procedures

PROC REPORT: force page break

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 89
Accepted Solution

PROC REPORT: force page break

Hi all,

how/can we force a page break in a COMPUTE BLOCK based on a variable like in DATA STEP programming using PUT _PAGE_ ??

I do NOT mean :

compute before xxxx _page_;

endcomp;

Regards,

Herman


Accepted Solutions
Solution
‎11-09-2011 10:03 AM
SAS Super FREQ
Posts: 8,743

PROC REPORT: force page break

Hi:

  If you are only using the SKIP variable for your forced page break, try this combination of BREAK/RBREAK statements:

BREAK AFTER gr_age    /  SUMMARIZE    ;
break before skip / page ;
RBREAK AFTER  /  SUMMARIZE  ;

I believe that you will get the grand total placed on the last page if you do a BREAK BEFORE SKIP.

Also, I would recommend that you make the GR_AGE variable an ORDER variable instead of a GROUP usage variable. You should be seeing this in the log:

NOTE: Groups are not created because the usage of xxxxxx is DISPLAY. To avoid this note, change all GROUP variables to ORDER variables.

cynthia

View solution in original post


All Replies
Super User
Posts: 9,676

PROC REPORT: force page break

A page break in proc report is achieve usually by break after/before.

You can not make a page break in compute block. But you can make a variable to break at appropriate place

by using break after/page.

Ksharp

Frequent Contributor
Posts: 89

Re: PROC REPORT: force page break

indeed, this seems to be the only solution and it works!! Smiley Happy

however, the reporting total also skips to a new page ???

that's the only issue I have so far Smiley Sad

quick example:

title;
ODS LISTING CLOSE;    
ODS PDF NOTOC FILE='c:\temp\mypdf.pdf'  STYLE=SASWEB NOTOC;   

proc sort data=sashelp.class;
by age;
run;
data WORK;
set sashelp.class;
if age < 13 then skip=0;
else skip=1;
gr_age=put(age,z4.) ;
run;


proc report data=WORK  nowd;
column skip name sex gr_age age ;
define skip / noprint group;
define name / display;
define sex  / display;
define gr_age / noprint group;
define age / analysis ;

BREAK AFTER gr_age    /  SUMMARIZE    ;
break after skip / page ;
RBREAK AFTER  /  SUMMARIZE  ;
quit;
ODS PDF  CLOSE ;                               
ODS LISTING ;

Solution
‎11-09-2011 10:03 AM
SAS Super FREQ
Posts: 8,743

PROC REPORT: force page break

Hi:

  If you are only using the SKIP variable for your forced page break, try this combination of BREAK/RBREAK statements:

BREAK AFTER gr_age    /  SUMMARIZE    ;
break before skip / page ;
RBREAK AFTER  /  SUMMARIZE  ;

I believe that you will get the grand total placed on the last page if you do a BREAK BEFORE SKIP.

Also, I would recommend that you make the GR_AGE variable an ORDER variable instead of a GROUP usage variable. You should be seeing this in the log:

NOTE: Groups are not created because the usage of xxxxxx is DISPLAY. To avoid this note, change all GROUP variables to ORDER variables.

cynthia

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 907 views
  • 3 likes
  • 3 in conversation