The SAS Output Delivery System and reporting techniques

Page Number in RTF

Reply
Contributor
Posts: 43

Page Number in RTF

Hello Everyone,

Is there a way to put the page number(in page x of y format) into the body of the document instead of header or footer section. In other words, page numbering when bodytitle is in effect or tagsets.rtf is used.

Thanks

RB 

SAS Super FREQ
Posts: 8,720

Re: Page Number in RTF

Hi:

  Using the technique described in this note (15727 - Writing PAGE X OF Y in RTF does not work with BODYTITLE) worked for me with TAGSETS.RTF. According to the note, there's no control over the placement if you use the style template method. For more help on this you might want to work with Tech Support.

cynthia

ods escapechar='^';

 

proc template;

  define style styles.test;

  parent=styles.rtf;

   style pageno from pageno /

    font=fonts("strongfont")

    posttext=" of ^{lastpage} ";

  end;

run;

 

title; footnote;

options nodate number pageno=1;

ods tagsets.rtf file='c:\temp\check_xofy.rtf' style=styles.test;

 

proc print data=sashelp.shoes;

title 'Using a Style Template';

run;

 

ods tagsets.rtf close;

Attachment
Contributor
Posts: 43

Re: Page Number in RTF

Hi Cynthia,

Thanks for the quick response, the problem I had here is i'm trying to have the page numbers within the body of the document instead of header or footer sections. Also with the rtf codes when I combine two or more rtf documents the page numbers are getting updated automatically as the word processor interprets the document as one.

Looks like proc report and compute block is the best option to get the page number(which doesn't change when two rtfs are combined), but I guess we need to pre process the dataset to get the total number of pages.

Another way could be to convert the rtf to dataset using infile and manipulate the record where we need and convert the dataset back to rtf, but I don't think/know there is a way to convert a dataset directly to rtf.

Thanks

SAS Super FREQ
Posts: 8,720

Re: Page Number in RTF

Hi:

  There were a lot of "pre-ODS" methods of generating page X of Y page numbering ... most of it involved either LISTING output or PostScript output. The issue with RTF is that the underlying architecture of the document involves being able to change the document. So if you use RTF field codes to insert page numbers and then you combine documents, the page numbers are not "frozen" numbers, they are field codes that are designed to be flexible. They are just not designed to behave the way you want. I'd recommend working with Tech Support on this.

cynthia

Ask a Question
Discussion stats
  • 3 replies
  • 3581 views
  • 3 likes
  • 2 in conversation