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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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