BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hello

In #Code below, {pageof} used with ODS Tagset does not show the page numbers when the word document is opened, however it is seen in print out and print previews. How can we see the page numbers when the document is opened. This issue was highlighted by audit.
Note: Need to use ODS Tagset


# Code
============================
ods escapechar='^';
title1 'Table 11-20 (Page ^{pageof})';
ods tagsets.rtf file='c:\test.rtf';
proc print data=sashelp.class noobs label;
run;
ods tagsets.rtf close;

Thank you very much
Sanjay Masawan
4 REPLIES 4
wayne_sas
SAS Employee
Hello Sanjay,

Titles and footnotes are tables in tagsets.rtf. As such the field edit instructions do not get executed by default on opening the file in edit mode. If you use Print Preview in Word, the instructions should be executed as if you were prinitng the doc.

Another way to get at this without the Print Preview setting is to use the PAGENO style element. This will give you the ability to change the page number setting that is imposed with an rtf "header" specification.

style pageno from pageno /
font = fonts("strongfont")
cellpadding = 0
cellspacing = 0
posttext="of (*ESC*){lastpage} ";
;
end;

then apply the style on the ODS statement.

ods tagsets.rtf file='Pageof.map' style=styles.pageof;
Cynthia_sas
SAS Super FREQ
Hi:
The {pageof} ESCAPECHAR function inserts Word field codes into your document. I believe you can toggle with Alt+F9 to reveal the codes. It makes sense to me that you'd see the page numbers only in Print Preview. The status bar in Word tells you what the page numbers are otherwise. I thought that page numbers only appeared in Edit mode when they were in the header/footer area of the document. Since TAGSETS.RTF doesn't put the page numbers in the header/footer area when you use {PAGEOF}, I tested what the default Word behavior will be.

If I go into Word (without using SAS) and start a new document and tell Word to put the page number in the body of the document (Insert --Page Numbers -- Current Position), I do NOT see page numbers until I am in Print Preview mode. What I see in the body of the word document is:
[pre]
{ PAGE \* MERGEFORMAT }
[/pre]

So, it seems to me that this issue is not with SAS, but with how Word treats page numbers inserted into the body of your document.


cynthia
deleted_user
Not applicable
Hello Cynthia,

How come it works fine with ODS rtf and not with tagset.
Please suggest a way to get this working.

Regards
Sanjay
Cynthia_sas
SAS Super FREQ
Hi:
There is nothing to "get working" ODS RTF is working as designed and ODS TAGSETS.RTF is working as designed. ODS RTF is the "original" RTF -- the page numbering instructions, when you use ODS ESCAPECHAR are inserted into the HEADER and FOOTER areas of the document, which then are resolved (by Word) when the document is opened in Edit mode. ODS TAGSETS.RTF works slightly differently, the SAS TITLE and FOOTNOTE are -inside- the document, but not in the HEADER and FOOTER area.

When you create a document with TAGSETS.RTF, the field codes do not show in the body of the document because of Microsoft Word behavior. These field codes are not shown in Edit mode -- that's how Word works.

Your choices are to switch back to ODS RTF so your titles and footnotes go into the header/footer area of the document or to use the style template method already outlined by Wayne in his answer to your question.

cynthia

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 4 replies
  • 3006 views
  • 2 likes
  • 3 in conversation