TEMPLATE Procedure: Creating Table Templates

Overview: ODS Table Templates

Using the TEMPLATE Procedure to Create or Customize Tabular Output

The TEMPLATE procedure enables you to customize the tabular appearance of your SAS output. With the TEMPLATE procedure, you can create and modify table templates, column templates, header templates, and footer templates. The Output Delivery System then uses these templates to produce customized tabular output for better data presentations and reports than what you get with the default SAS output. You can also create you own master tables using templates.
By default, ODS output is formatted according to the various definitions or templates that the procedure or DATA step specify. However, you can customize existing tabular output templates, or create your own new tabular output templates, by using the TEMPLATE procedure with these statements.
PROC TEMPLATE Statements
Customization
Element Modified
Statement
Column presentation
Column template
Table footer
Footer template
Table header
Header template
Single output object
Table template
An existing template for a table, column, header, or footer
Table, column, header, footer

What You Can Do with a Table Template

Default Listing and RTF Display of an Output Object

By default, ODS uses the table template specified by the procedure or DATA step to create ODS output. For example, the following display shows the default LISTING output of the Moments output object created by PROC UNIVARIATE. The second display shows the default RTF output of the same output object.
LISTING Output from PROC UNIVARIATE (Default Moments Table)
LISTING Output from PROC UNIVARIATE (Default Moments Table)
RTF Output of Sales Statistics from PROC UNIVARIATE (Default Moments Table)
RTF Output of Sales Statistics from PROC UNIVARIATE (Default Moments Table)

Customized Version of the Listing and RTF Display of an Output Object

With PROC TEMPLATE, you can change many of the table elements and obtain a customized format for the output objects. Here are some of the elements that you can change:
  • the color and the font of the text of the first table header
  • the justification of the first table header
  • the setting of the table attributes UNDERLINE and OVERLINE
  • the line spacing between the rows
Note: Not all table template changes affect all destinations. For example, font changes are ignored in the LISTING destination.
The following displays show the results of using a customized table template that changes the first table header attributes, sets underlining and overlining in the table, and changes the amount of spacing between rows.
LISTING Output from PROC UNIVARIATE (Customized Moments Table)
LISTING Output from PROC UNIVARIATE (Customized Moments Table)
RTF Output of Sales Statistics from PROC UNIVARIATE (Customized Moments Table)
RTF Output of Sales Statistics from PROC UNIVARIATE (Customized Moments Table)