BookmarkSubscribeRSS Feed
kartik
Calcite | Level 5

When creating a ODS RTF File, the first page displays PAGE 1 of 1 even though it has 20 pages for example. I used the following code:

ods rtf file ="<path>\<filename.rtf";

ods escapechar='^';

title "Page ^{thispage} of ^{lastpage}";

<proc report satement>

ods rtf close;

All the other pages has the page numbers displayed correctly. e.g., "Page 2 of 20"

Also, when i double kick anywhere on the firstpage, the page number gets automatically corrected. from "Page 1 of 1" to "Page 1 of 20"

help me by providing a solution..

1 REPLY 1
RW9
Diamond | Level 26 RW9
Diamond | Level 26

There isn't a solution.  What is happening is that the RTF file you generate is text with markup codes.  When it is opened with MS Word (or other RTF reader) Word opens the text file and goes through parsing the file in order to render the text with the markup present.  The page x of y is calculated (i.e. it does not appear in the text until generated) once the markup is processed and the output almost generated, therefore there is a certain lag.  Scrolling down or doing any of that will update it.  If you for instance take a large file - say 70 odd pages you will actually see Word processing its internal counts as it loads and process, i.e page 1 of 1, followed by 2 of 10, followed by 6 of 70, after Word has processed the whole document though it will appear correctly and printing the file to PDF or saving the file as .docx will embed the page numbers in.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1 reply
  • 1217 views
  • 0 likes
  • 2 in conversation