BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Jaheuk
Obsidian | Level 7

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

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
Diamond | Level 26

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

3 REPLIES 3
Ksharp
Super User

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

Jaheuk
Obsidian | Level 7

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 ;

Cynthia_sas
Diamond | Level 26

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

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 6212 views
  • 3 likes
  • 3 in conversation