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

Hi all,

And I am using below proc report but in output it splits summary stats from one page to another. as below:

 

But I want highlighted category starts from next page. Could you please help me. Below is my code.

proc report data=abc center headline nowindows missing split='|';
  column ord col1 col2 col3 col4 col5;

	define ord / order order=data noprint ;
    define col1/  display "" style(column)=[cellwidth=40% protectspecialchars=off asis=on];;
  	define col2 / display "" style(column)=[cellwidth=10% Just=c];
	define col3 / display " Treatment A" style(header)=[just=C] style(column)=[cellwidth=10% just=C] ;
	define col4 / display " Treatment B" style(header)=[just=C] style(column)=[cellwidth=10% just=C] ;
	define col5 / display "Total" style(header)=[just=C] style(column)=[cellwidth=10% just=C] ;

	compute before _page_;
    	line "";
  	endcomp;

run;

Thanks,

Adithya

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:
Just as you have created an ORD variable to keep your rows in order, you may have to create your own PAGEORD variable so that you have everything before "Number of COPD..." on one page and every after on another page. Then you can just use
break after PAGEORD / page;

Here's an example -- not using your data, but the concept with SASHELP.CLASS to put in an arbitrary pagebreak. In my code, I've created a PAGEORD variable so that ages 11 and 13 appear on 1 page and ages 12 and 14 appear on page 2.

data makepg;
  set sashelp.class;
  where age le 14;
  ORD=_n_;
  if age in (11,13) then pageord=1;
  else if age in (12,14) then pageord=2;
run;
    
ods pdf file='c:\temp\multpage.pdf';
proc report data=makepg;
  title 'break after helper variable pageord';
  column pageord ord name sex age height;
  define pageord / noprint order;
  define ord / noprint order;
  define name / display;
  define sex / display;
  define age / display;
  define height / display;
  break after pageord / page;
run;
  
ods pdf close;


Hope this helps,
Cynthia

View solution in original post

1 REPLY 1
Cynthia_sas
SAS Super FREQ

Hi:
Just as you have created an ORD variable to keep your rows in order, you may have to create your own PAGEORD variable so that you have everything before "Number of COPD..." on one page and every after on another page. Then you can just use
break after PAGEORD / page;

Here's an example -- not using your data, but the concept with SASHELP.CLASS to put in an arbitrary pagebreak. In my code, I've created a PAGEORD variable so that ages 11 and 13 appear on 1 page and ages 12 and 14 appear on page 2.

data makepg;
  set sashelp.class;
  where age le 14;
  ORD=_n_;
  if age in (11,13) then pageord=1;
  else if age in (12,14) then pageord=2;
run;
    
ods pdf file='c:\temp\multpage.pdf';
proc report data=makepg;
  title 'break after helper variable pageord';
  column pageord ord name sex age height;
  define pageord / noprint order;
  define ord / noprint order;
  define name / display;
  define sex / display;
  define age / display;
  define height / display;
  break after pageord / page;
run;
  
ods pdf close;


Hope this helps,
Cynthia

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
  • 1 reply
  • 1053 views
  • 1 like
  • 2 in conversation