BookmarkSubscribeRSS Feed
hardusheth
Calcite | Level 5

Hello All. 

 

I am currently working Patient profile in which i am using ODS RTF to generate profile in RTF. We want to have Table of Contents with appropriate page numbering and i am having trouble to get both Table of Contents and Page Numbering. 

 

here is my ODS RTF code in which i am presenting Contents = Yes for TOC and Thispage and Lastpage in my footnote for pagenumer. I am getting appropriate Table of Content however page Number is messing up because of table of contents. it is counting one page extra at the end of report. e.g. "Page 89 of 90" on last page. 

 

options nodate nonumber;
ods listing close;
ods rtf file="p-&&subj&i.._hs.rtf" toc_data contents=yes;
ods escapechar='~';


footnote1 j=l font=arial bold height=10pt "Program: Patient Profiles/l-patient-profiles.sas"
j=r font=arial bold height=10pt "Page ~{thispage} of ~{lastpage}";

any feedback or suggestion would highly appreciated. 

 

Thank you,

HS.

2 REPLIES 2
Cynthia_sas
SAS Super FREQ

Hi:

  As usual, when questions like this arrive, I ask myself how does Word act with a Table of Contents without SAS or ODS being in the picture. So I made a 3 page document using Heading 1 style for the Header on each page. Now, I have a 3 page document and I add page numbers in page x of y format at the bottom of the page. So far, so good. Page numbers show as page 1 of 3, 2 of 3 and 3 of 3, as expected.

  Then I go to References and generate a table of contents page. Immediately on creation, I get  a TOC with my Heading1 text as the 3 links and now the pages show as 1 of 4, 2 of 4, etc. So it seems that Word "counts" the Table of Contents page.

  I note that if I edit the footer, I can turn off the page numbers on the first page, but still the total page count is 4. So I think the hitch in this giddy-up is caused by Word behavior and not ODS RTF. ODS can only send the control strings for RTF and it is up to Word to render the RTF control strings into Word document format. So it seems that both ODS RTF and Microsoft Word are behaving the same way.

  You might try opening a track with Tech Support to see whether there might be a workaround for this issue, but my guess is that any workaround is going to be some kind of Word document fixes after the fact and not anything you can implement with ODS RTF.

 

Cynthia

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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