DATA Step, Macro, Functions and more

Page reset in a single file

Posts: 43

Page reset in a single file

I received this request from FDA , to generate a site level listing.

For example, if its an  Adverse event listing, so they want all AEs to subjects from that site first and then page break by nest site and so on, whih is okay.

I can use page break option by site.

But the catch is, they want to reset the page no as well for the next site. I don't know how to do that. For example, they want page 1 of page 10 for next site in the same file.

Is there a way we could do that?

Also, is their any option which can create a table of content for all those sites in pdf, so that i can click on the link in TOC, and go to that site?

I am using proc report to generate the listings.

Your inputs are really appreciated.



Posts: 9,367

Re: Page reset in a single file

Posted in reply to maggi2410


  The issue that you are going to run into is that you want the first report to have page 1 of 10, page 2 of 10; and then you want to start over at page 1 of 10, page 2 of 10. You can reset the beginning page number. But by default, what you will get is page 1 of 20, page 2 of 20 and then after page 10 of 20, numbering would start over with page 1 of 20, page 2 of 20 again. You can see how it works for yourself with this example (only 4 pages total):

ods escapechar='^';

options pageno=1 nonumber nodate;

ods pdf file='c:\temp\testpgno.pdf';

proc report;

title1 j=r 'Page ^{thispage} of ^{lastpage}';




options pageno=1;

ods pdf;

proc report data=sashelp.prdsale(obs=40);

title1 j=r 'Page ^{thispage} of ^{lastpage}';




ods pdf close;

But, note that one way to reset page numbers is to do it between procedure steps. The PROC REPORT statement allows you to use the BYPAGENO= option, when you have a BY statement, but again, that would give you 1 of 20, 2 of 20, etc for the first group and then 1 of 20, 2 of 20, etc for the second group.

Your only way to work it is to probably do it as 2 separate documents that you put together using an Adobe product or some 3rd party software to combine PDF files.



Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation