DATA Step, Macro, Functions and more

How to add cont'd after page break in proc report ?

Reply
Occasional Contributor
Posts: 11

How to add cont'd after page break in proc report ?

[ Edited ]

Hi,

 

I am trying to generate a proc report from a huge sas dataset. I am having troubles while doing page break. I need to display (cont'd) as shown below in Example. I am able to create Output from Dataset 1. But I need to add Sub Cat 2 (cont'd) as shown below when page break occurs and report goes to 2nd page. How do I accomplish this ?

 

Below is just for example. I am working with a huge dataset which has 100s of Categories and Sub Categories. How do I write the code to create a page break and show (cont'd) in the next page along with the Sub Cat name at which the page break occured ?

 

test.jpg

 

Any help would be appreciated. Thanks much !

Super User
Posts: 10,035

Re: How to add cont'd after page break in proc report ?

Could you use compute block ?

 

compute after _page_;

 col='Continued ...... ';

endcomp;

Super User
Super User
Posts: 7,970

Re: How to add cont'd after page break in proc report ?

Well, not much info given there, so bit of a guess.  What I always do with my outputs is declare a page variable up front so I know exactly where the breaking will occur - you can do this as simply as saying X amount of observations = page 1, X amount= page 2 etc. or more complicated.  But that is a different topic.  Then in the proc report you break on that variable and page, then you can also use that to compute:

data want;
  set sashelp.class;
  if _n_ <= 10 then pge=1;
  else pge=2;
run;

ods rtf file...;
proc report...;
  columns _all_;
  define pge / noprint;
  define...;

  break after pge / page;
  compute after pge;
    line 'Contd...';
  endcomp;
run;
ods rtf close;
Occasional Contributor
Posts: 11

Re: How to add cont'd after page break in proc report ?

Hi. Thanks for the reply. I have to mention the Category/Sub Cat along with (cont'd). In the above example it is Sub Cat 2 ( cont'd). But when I am working with a huge dataset with 100s of Categories/Sub Cats how do I get which Sub Cat the page is breaking at ?
Super User
Super User
Posts: 7,970

Re: How to add cont'd after page break in proc report ?

You need to tell the code.  Have a look at the output, roughly how many do you want on one page?  That then becomes your logic.  You could create some algorithm to do it, and I have seen these floating around but they tens to be vast complicated things that only work half the time.  You know your data and what you want your report to look like, so you need to fix it how you want.

Ask a Question
Discussion stats
  • 4 replies
  • 246 views
  • 0 likes
  • 3 in conversation