BookmarkSubscribeRSS Feed
ellouho1
Calcite | Level 5

Dear members,

 

I am producing a report and I was asked to display  the page numbering in the footnote as 'Page X of  Y', I found a solution thanks to you in this forum but the Y (lastpage) was not correct as I have only 5 pages but it shows 6 pages. maybe because of a not shown blank page at the end.

 

So I was wondering if this ^{lastpage} can be saved in a macro variable?

 

Best regards,

3 REPLIES 3
Cynthia_sas
Diamond | Level 26
Hi:
You must be creating either PDF or RTF output. You cannot save the ESCAPECHAR {lastpage} value in a macro variable, it is created dynamically based on the data that is being routed to either the PDF file or the RTF file.

I have never seen a "not shown" blank page in ODS output. I have seen instances in both PDF and RTF, where an actual blank page is created, typically because the margins need to be adjusted.

My suggestion is that you alter the papersize option and the margin options and the orientation in order to see whether you can get the correct value for ESCAPECHAR {lastpage} in your final output.

If altering the margins don't work for you, then you might want to open a track with Tech Support. They can look at your actual data and ALL your code and try to replicate the issue. Then, they can help you with the solution.
Cynthia
ellouho1
Calcite | Level 5

Hi Cynthia,

 

I tried to change PAGESIZE,LINESIZE,MARGINS but no solution.


However, this issue comes only when I add the step to create 'Table of contents' by adding "contents=yes notoc_data" to the ODS.

 

Without those ODS options I get the real Last page number.

 

Best regards

Cynthia_sas
Diamond | Level 26
Hi:
Does that mean that your page count is off by 1? My guess is that the table of contents page is getting counted by Word as a page. I don't know whether this is how Word is designed or not. This would be a question for Tech Support. They will need to look at your code to test.
Cynthia

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1469 views
  • 0 likes
  • 2 in conversation