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.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 998 views
  • 0 likes
  • 2 in conversation