BookmarkSubscribeRSS Feed
Fluorite | Level 6

Good morning,
We are generating in SAS an RTF file in which we are creating a table of contents.
For the table of contents to appear we have to select the entire document and press F9.
The important thing is that we want to remove that manual, we want the automatic table of contents to come out.
Do you know any way to do it? thanks greetings


 ods rtf text= "~S={outputwidth=100% just=l}{\field{\*\fldinst {\\TOC \\f \\h} } }";
ods RTF text="{\tc {\b\fs18\ql {Tabla &v_num..- MATRICULACIONES POR TIPOS DE VEHÍCULOS} \par}}";run;
SAS Employee

The Table of Contents will not automatically be populated. You will need to do this as documented below:


produces a table of contents page for RTF documents that are opened in Microsoft Word. The table of contents page contains a Table of Contents field, which puts all of the contents information that is embedded in the document into a table of contents. To expand the table of contents, right-click under the title in Microsoft Word and select Update Field from the selection list.


Also see:


Fluorite | Level 6

Thank you very much for the reply.
What we need is that the rtf report appears with the index/table of contents without updating the file when opening it.
In the link you sent me you have to update the references.

Super User
If you have XCMD enabled and are trying to automate a process I would write a VBS or PowerShell script that automated this and then run it at the end.
Fluorite | Level 6

Thank you very much for your answer.
For security, XCMD is not activated in our SAS.

we can't run scripts.



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg



Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 3 in conversation