BookmarkSubscribeRSS Feed
omka_
Fluorite | Level 6

Hi everyone,

 

I am using SAS v9.4. i am creating a report for a complex table with all the subjects listing down with parameters wrapping around the pages and descriptive statistics at the bottom- attached is an example.  However, I am having trouble creating the page break at the right place. I have made a dummy variable that changes from number 1 to 2 after subject 1001-518, which is where I need the page to break and go to the next page. Instead of going to the next page, SAS is squeezing the parameters that should be on the next page into the same page. If someone can solve this issue it would be much appreciated. I have pasted the code below along with the table. Thanks.

 

proc report data=final_1 nowd nocenter headline headskip missing split="~" list 
STYLE(REPORT)=[FRAME=above RULES=GROUP just=center bordercolor=black outputwidth =10 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 _LABEL_ dummy dummy1 charcol1 - charcol16;

define _LABEL_     / ID "Subject ~ Number" style(column)=[just=c cellwidth= .55in ] style(header)=[just=c];
define dummy     / group order order=data "Subject ~ Number" style(column)=[just=c cellwidth= .4in ] style(header)=[just=c] noprint;
define dummy1     / group "Subject ~ Number" style(column)=[just=c cellwidth= .4in ] style(header)=[just=c] noprint;
define charcol1   /  "AUC^{sub 0-4h} ~ (h*ng/mL)" style(column)=[just=c cellwidth=.9in ] style(header)=[just=c];
define charcol2    /  "AUC^{sub 0-24h} ~ (h*ng/mL)" style(column)=[just=c cellwidth=.7in ] style(header)=[just=c];
define charcol3    /  "AUC^{sub 0-t} ~ (h*ng/mL)" style(column)=[just=c cellwidth=.7in ] style(header)=[just=c];
define charcol4    /  "C^{sub max} ~ (ng/mL)" style(column)=[just=c cellwidth=.6in ] style(header)=[just=c];
define charcol5    /  "C^{sub 10min} ~ (ng/mL)" style(column)=[just=c cellwidth=.6in ] style(header)=[just=c];
define charcol6    /  "C^{sub min} ~ (ng/mL)" style(column)=[just=c cellwidth=.6in ] style(header)=[just=c];
define charcol7    /  "T^{sub max} ~ (h)" style(column)=[just=c cellwidth=.65in ] style(header)=[just=c];
define charcol8    /  "t^{sub lag} ~ (h)" style(column)=[just=c cellwidth=.65in ] style(header)=[just=c];
define charcol9    /  "t^{sub last} ~ (h)" style(column)=[just=c cellwidth=.65in ] style(header)=[just=c];
define charcol10    /  "t^{sub 1/2} ~ (h)" style(column)=[just=c cellwidth=.65in ] style(header)=[just=c];
define charcol11   /  "^{unicode lambda}^{sub z} ~ (1/h)" style(column)=[just=c cellwidth=.65in ] style(header)=[just=c];
define charcol12   /  "V^{sub z}/F ~ (L)" style(column)=[just=c cellwidth=.65in ] style(header)=[just=c];
define charcol13   /  "DN-AUC^{sub 0-4h} ~ (h*ng)/mL/mg)" style(column)=[just=c cellwidth=.65in ] style(header)=[just=c];
define charcol14   /  "DN-AUC^{sub 0-24h} ~ (h*ng)/mL/mg)" style(column)=[just=c cellwidth=.65in ] style(header)=[just=c];
define charcol15    /  "DN-AUC^{sub 0-t} ~ (h*ng)/mL/mg)" style(column)=[just=c cellwidth=.65in ] style(header)=[just=c];
define charcol16   /  "DN-C^{sub max} ~ (ng/mL/mg)" style(column)=[just=c cellwidth=.65in ] style(header)=[just=c];


break after dummy/ skip page ;

compute dummy1;
	if dummy1 > 1 then call define(_row_,'style', 'style={bordertopcolor=black bordertopwidth=3}');
endcomp;

compute before dummy1;
	line " ";
endcomp;


run;

ods rtf close;
ODS LISTING;
title;
footnote;
3 REPLIES 3
Cynthia_sas
SAS Super FREQ

Hi:

  I'm not sure why you have _LABEL_ and DUMMY and DUMMY1, and without data, no one can run your code. However, using SASHELP.CARS and simplifying your code somewhat, I isolated the code to essentially doing a PAGE with the BREAK statement for every value of MAKE in SASHELP.CARS (first I made a subset that was just 3 MAKES, Audi, BMW and Volvo). And, as you can see in the attached output, I do get correct page breaks from PROC REPORT when using the RTF destination:

break_page.png

 

  I don't completely understand your data, so I realize that my use of SASHELP.CARS does not exactly mimic your data, but it does prove that PAGE works.

 

Cynthia

omka_
Fluorite | Level 6

Hi, I apologize for not attaching the data. It is attached now. _Label_ is the column which has the subject ID's (1001-501 to 1001-524), dummy is the variable to use for the page break, since I want the page to break after subject 1001-518, and dummy1 is used for the compute block to create the horizontal line that goes between the last subject and the descriptive statistics. Please try my data with the proc report and see if you can get the page break to work. Thanks.

Cynthia_sas
SAS Super FREQ

Hi:

  I finally had a chance to try your dataset. When I simplified your code and took out all the cellwidths and reduced the font and used the JOURNAL style, everything fit on 1 landscape page width and the page breaks worked as designed.

 

  The issue with your original code was twofold:

1) your font was Courier for the Headers, and not specified as a particular font_size in PT size, but as a relative number, which allowed Word to assign a font size of 9.5 in my Word.

2) you "over-controlled" the cellwidths so they didn't fit in 10" by reducing the font and removing the cellwidths (except for _LABEL_), that allowed ODS to determine the spacing to fit on one page.

 

Here's the simplified code:

simplified_break_code.png

 

And here's the output showing the page break:

simplified_break_output.png

Note that using JOURNAL style automatically puts a line underneath the table on the end of each page, so I didn't need your code in the COMPUTE block.

 

I tried to highlight everything I changed.

 

Hope this helps,

Cynthia

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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