BookmarkSubscribeRSS Feed
omka_
Fluorite | Level 6

Hi everyone,

 

I am having trouble creating the page break. I have two dummy variables, the first one called dummy, is the number of observations. Dummy is used in the compute block to create a space in between each observation. The second variable, called dummy1, is being used to create a page break. However, the output is not being created properly. I have two group statements as well and it is using the group statement from dummy and creating the break using that variable. I need it to create the break using the dummy1 variable. Please let me know how I can fix this. Thanks.

 

options mlogic mprint nodate nonumber nobyline ls=256 orientation=landscape 
leftmargin=1.0in rightmargin=1.0in topmargin=1.5in bottommargin=1.0in missing=" " ;

ods escapechar "^";
%LET currentdate=%SYSFUNC(date(),date9.);
%LET currenttime=%SYSFUNC(time(),hhmm6.);
%LET path=%sysget(SAS_EXECFILEPATH);

ODS LISTING CLOSE;

ods rtf file="page.rtf" style=styles.minimal ;

proc report data=finalfinal nowd nocenter headline headskip missing split="~" list 
STYLE(REPORT)=[FRAME=above RULES=GROUP just=center bordercolor=black outputwidth = 9 in cellpadding=2 cellspacing=1]
STYLE(HEADER)=[frame=below font_size=1 font_face="Courier New" just=c font_weight=bold cellpadding=2pt]
STYLE(COLUMN)=[frame=below];
columns dummy side q18_1 freq1 freq1_1 dummy1;

define dummy / group order = data noprint;
define side      / "Type of Insurance" style(column)=[just=c cellwidth=1.5in] style(header)=[just=c];
define q18_1     / "Response" style(column)=[just=c cellwidth=.5in] style(header)=[just=c];
define freq1     / "OFF Population" style(column)=[just=c cellwidth=1.0in ] style(header)=[just=c];
define freq1_1   / "Not OFF Population" style(column)=[just=c cellwidth=1.0in ] style(header)=[just=c];
define dummy1    / group noprint;

compute before dummy;
	line " ";
endcomp;

break after dummy1/ page;

run;

ods rtf close;
ODS LISTING;
title;
footnote;
6 REPLIES 6
ballardw
Super User

Try moving DUMMY1  to the first position of the COLUMN statement and see that looks more like what you need.

 

Since Proc Report builds things from left to right then you want the page break indicator before the elements you want to appear on the page.

Cynthia_sas
SAS Super FREQ

Hi:

  This seems very similar to the same question that you've posted in this Forum and in the SAS Programming forum before. Here are a few of the previous postings which seem to be related.

 

Here's one https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-Break-After-Page-not-working/m-p/5... where I posted a working example of code on Thursday, last week.

 

Also, it seems related to this forum posting too: https://communities.sas.com/t5/SAS-Programming/Proc-Report-Break-After-Page-problem/m-p/567396#M1595...

 

Without data, no one can test your code and your code is specific to the structure of the input data, so asking people to figure out the data structure AND make fake data to run your code is a big ask.

 

  Didn't any of the previous forum postings on this topic help you??

 

Cynthia

omka_
Fluorite | Level 6

Hi Cynthia,

 

Yes it is similar to the problem I posted last week but something is not working. It may be a small syntax problem but I posted here just in case someone else caught it. Also the data is called finalfinal and I posted it in the original post.

Cynthia_sas
SAS Super FREQ

Hi, I guess I missed that post where you had data. I found the data and made some suggestions in the next post.

 

Cynthia

Cynthia_sas
SAS Super FREQ

Hi:

  I did find your data. Again, options like HEADLINE and HEADSKIP don't make sense for RTF. Also, ALWAYS recommend units of measure: PT for font sizes, PX or PT for cellspacing and cellpadding. Also, FRAME= only works for the entire TABLE, not individual headers or columns, so adding FRAME for HEADER or COLUMN overrides doesn't make sense. You should be receiving a message in the log about GROUP being the WRONG usage. It is an easy fix, the log tells you to change the usage to ORDER.

 

  The biggest issue I saw was that DUMMY1 (for paging) needed to be the first or leftmost column listed in the COLUMN statement. When I did this, I got the the correct paging:

revised_code_output_2pgs.png

 

I took the NOPRINT off DUMMY1 and DUMMY so you could see why it has to be FIRST in the COLUMN statement (as @ballardw correctly suggested earlier).

 

Here's the revised code -- I color coded the changes. I think I got most of them:

revised_code.png

 

Cynthia

ballardw
Super User

@omka_ wrote:

Hi Cynthia,

 

Yes it is similar to the problem I posted last week but something is not working. It may be a small syntax problem but I posted here just in case someone else caught it. Also the data is called finalfinal and I posted it in the original post.


Have you run the code with the change I suggested to your COLUMN statement?

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

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
  • 6 replies
  • 2168 views
  • 0 likes
  • 3 in conversation