The SAS Output Delivery System and reporting techniques

Page x of y for ODS > PDF page limit?

Posts: 0

Page x of y for ODS > PDF page limit?


I have been using code similar to this:

ods escapechar='!';
footnote1 j=r "Page !{thispage} of !{lastpage}";

..for sometime now to produce 'page x of y' in the footer of my Proc Report ods -> PDF output. I believe that I have run up against a limit in using this method related to the {lastpage} tag. If the output is >500 pages, the program seems to hang using ever greater amounts of memory. A program that would normally take less that a minute to complete without the {lastpage} tag in the footnote runs for at least 15 minutes (I lose patience and kill the job at this point). I have only experienced this with output > 500 pgs. It seems to be due only to the {lastpage} tag -- changing the footnote to:

footnote1 j=r "Page !{thispage}";

..brings the execution time back to under a minute even for 800+ pages. I have tried a custom style template with page x of y defined in the PageNo section (see SUGI paper 132-30 by Lauren Haworth):

Style PageNo from TitlesAndFooters
"Controls page x of y in the footer" /
font = fonts("TitleFont2")
cellpadding = 0
cellspacing = 0
pretext = "Page "
posttext = " of !{lastpage}"

..with the same effect. Has anyone else encountered this problem, or better yet, know of a work around?

SAS Employee
Posts: 50

Re: Page x of y for ODS > PDF page limit?


I'm wondering if you are hitting a memory limit on your machine. Is it possible to share your data with me so I could run it here.

Email me at

Posts: 0

Re: Page x of y for ODS > PDF page limit?

Hi Scott,

Unfortunately I don't think that I can share the data without getting releases and such. I can tell you that the dataset that Proc Report was working on had 2698 obs and that because of wrapping on various text columns in the report I would typically get 4-5 obs per page. I don't know if that is enough to go on. I think that my pc is relatively robust -- it has 2GB of memory and an quad processor and I do not typically have a lot of other apps running. I watched the memory usage while the job was running and while the memory kept climbing slowly when I gave up on the job it had reached the 100MB range with about 25% CPU. One other piece of information is that after terminating the SAS process the PDF file created had approx 400 of 600+ pages written but was 500MB in size. If I took out the {lastpage} tag from the footnote all 600+ pages would write in less than 1 minute and the file size was 5MB. Let me know if this is helpful.

Ask a Question
Discussion stats
  • 2 replies
  • 2 in conversation