04-20-2016 03:35 AM - edited 04-20-2016 08:06 AM
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 ?
Any help would be appreciated. Thanks much !
04-20-2016 04:32 AM
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;
04-20-2016 08:02 AM
04-20-2016 08:49 AM
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.