BookmarkSubscribeRSS Feed
sasjourney
Calcite | Level 5

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 

3 REPLIES 3
Cynthia_sas
SAS Super FREQ

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;


X_of_Y.png
sasjourney
Calcite | Level 5

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

Cynthia_sas
SAS Super FREQ

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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