The SAS Output Delivery System and reporting techniques

When creating a ODS RTF File, the first page displays header part as PAGE 1 of 1 even though it has n number of pages.

Reply
New Contributor
Posts: 2

When creating a ODS RTF File, the first page displays header part as PAGE 1 of 1 even though it has n number of pages.

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

Super User
Super User
Posts: 7,977

Re: When creating a ODS RTF File, the first page displays header part as PAGE 1 of 1 even though it has n number of pages.

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.

Ask a Question
Discussion stats
  • 1 reply
  • 392 views
  • 0 likes
  • 2 in conversation