In ODS HTML, PDF, and RTF, how can I change the text specified at the top of the table of contents or table of pages?


The title for the contents and page files can be modified in the style-element Text and in the argument associated with the string "content title"; see example 1 below. These titles can also be modified directly in the style element that renders the "table of contents" title, which is ContentTitle; see example 2 below. View output.


/* Example 1 */

proc template;
   define style styles.test;
   parent=styles.default;
      replace text /
              'Fatal Banner' = 'FATAL:'
              'Error Banner' = 'ERROR:'
              'Warn Banner' = 'WARNING:'
              'Note Banner' = 'NOTE:'
              'Pages Title' = 'Table of Pages'
              'Content Title' = 'New Title'
              'suffix1' = ' Procedure'
              'prefix1' = 'The ';
   end;
run;

/* Example 2 */

proc template;
   define style style.test;
   parent=styles.default;
      replace ContentTitle from IndexTitle /
              PRETEXT='New Title';
   end;
run;

 

The PDF and RTF destinations also have the ability to generate a Table of Contents page. The Full Code section shows how to change the Table of Contents title in each of those destinations.

See also the full PROC TEMPLATE FAQ and Concepts.


Full Code

The PDF and RTF destinations each have the ability to generate a Table of Contents (TOC) page. The following code shows ho8w to change the Table of Contents title in each of those destinations.

Please note: To create a visible table of contents in the RTF file, you must update an RTF instruction field by doing the following: With your cursor in the body of the page, select your right mouse button to display a pop-up menu. Select Update Field from the menu, which causes Microsoft Word to scan the document and build a table of contents on that page, below the (now updated) title.

/* Example 1 */

proc template;
   define style styles.test1;
   parent=styles.printer;
      style text /
        'Content Title' = 'New Title Ex. 1'
        'continued' = '(Continued)'      
            'Fatal Banner' = 'FATAL:'
            'Error Banner' = 'ERROR:'
            'Warn Banner' = 'WARNING:'
            'Note Banner' = 'NOTE:'
            'Pages Title' = 'Table of Pages'
            'suffix1' = ' Procedure'
            'prefix1' = 'The ';
   end;
run;

ods rtf file="file1.rtf" contents toc_data style=styles.test1;
ods pdf file="file1.pdf" contents=yes style=styles.test1;

proc print data=sashelp.class; 
run;

ods _all_ close;


/* Example 2 */

proc template;
   define style styles.test2;
   parent=styles.printer;
      style ContentTitle from ContentTitle /
            pretext='New Title Ex. 2';
   end;
run;

ods rtf file="file2.rtf" contents toc_data style=styles.test2;
ods pdf file="file2.pdf" contents=yes style=styles.test2;

proc print data=sashelp.class; 
run;

ods _all_ close;


Output

RTF Example #1

Please note: To create a visible table of contents in the RTF file, you must update an RTF instruction field by doing the following: With your cursor in the body of the page, select your right mouse button to display a pop-up menu. Select Update Field from the menu, which causes Microsoft Word to scan the document and build a table of contents on that page, below the (now updated) title.

PDF Example #1