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
SAS Super FREQ

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
SAS Super FREQ

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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