BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
dmuenz
Calcite | Level 5

I want my PDF output to have a footnote like "Page X of Y". I can use the following footnote statement, and it works fine in PC SAS 9.4M8, but it fails in SAS Studio 3.8 with SAS 9.4M6 as the backend:

footnote 'Page (*ESC*){thispage} of (*ESC*){lastpage}';

Here's a full example:

ods pdf file="page number test.pdf";

footnote1 '(1) Page (*ESC*){thispage} of (*ESC*){lastpage}'; * fails in SAS Studio;
footnote2 '(2) Page (*ESC*){thispage}'; * works in SAS Studio;
footnote3 '(3) Total pages: (*ESC*){lastpage}'; * fails in SAS Studio;
proc print data=sashelp.class;
run;

ods pdf close; 

 Here's a screenshot of the footnotes in the resulting PDF, created with SAS Studio:

dmuenz_0-1736539839724.png

Note that {thispage} works fine, but {lastpage} -- which should resolve to the total number of pages -- does not. I don't know if the problem is with SAS Studio or if it's a bug in SAS 9.4M6 that was fixed by 9.4M8.

 

A very similar question has been asked before (https://communities.sas.com/t5/SAS-Programming/Page-numbers/td-p/681221), though there's no mention of what SAS UI or backend they're using, and there's no real solution since the problem seemed to disappear for the OP.

 

Is there a way to get this working in SAS Studio with SAS 9.4M6? My company will be phasing out PC SAS very soon.

1 ACCEPTED SOLUTION

Accepted Solutions
Bari_sas
SAS Employee

Try using this statement before your ODS PDF file= statement:

 

options printerpath=pdf;

 

Here's a SASnote for reference:

https://support.sas.com/kb/56/041.html

View solution in original post

3 REPLIES 3
SASKiwi
PROC Star

ODS evolved quickly over the last few maintenance releases so my guess is that it was a bug in M6 that was then fixed in a later release. The way to fix this would be to upgrade your SAS 9.4M6 servers to M8. Perhaps you can ask your SAS administrators if there are any plans to upgrade? FYI, full support for SAS 9.4M6 expires Jan 2025.

Bari_sas
SAS Employee

Try using this statement before your ODS PDF file= statement:

 

options printerpath=pdf;

 

Here's a SASnote for reference:

https://support.sas.com/kb/56/041.html

dmuenz
Calcite | Level 5

Thank you! Setting the printerpath option fixed the problem; now the code works correctly in both PC SAS 9.4M8 and in SAS Studio with SAS 9.4M6.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 448 views
  • 1 like
  • 3 in conversation