SAS 9.1 Output Delivery System Users Guide

Overview: ODS Tabular Output

Why Use 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 definitions, column definitions, header definitions, and footer definitions. The Output Delivery System then uses these definitions to produce customized tabular output for better data presentations and reports than what you get with the default SAS output.

By default, ODS output is formatted according to the various definitions that the procedure or DATA step specify. However, you can customize your tabular output definitions, or create your own new tabular output definitions, by using the TEMPLATE procedure with the following statements.

Customization

Modify

Statement

Column presentation

column definition

DEFINE COLUMN

Table footer

footer definition

DEFINE FOOTER

Table header

header definition

DEFINE HEADER

Single output

object table definition

DEFINE TABLE

An existing definition for a table, column, header, or footer

table, column, header, footer

EDIT

Terminology

For definitions of terms used in this section, see 'Terminology: TEMPLATE Procedure' on page 266.

What Can You Do with a Table Definition?

Default Listing and RTF Display of an Output Object

By default, ODS uses the table definitions specified by the procedure or DATA step to create ODS output. For example, the following display shows the default listing output of the Basic Statistical Measures output object created by PROC UNIVARIATE. The second display shows the default RTF output of the same output object. You can use PROC TEMPLATE to customize the Basic Statistical Measures table definition.

Output 10.1: Listing Output from PROC UNIVARIATE (Default Basic Statistical Measures Tables)

The SAS System The UNIVARIATE Procedure Variable: CityPop_90 (1990 metropolitan pop in millions) Basic Statistical Measures Location Variability Mean 3.877020 Std Deviation 5.16465 Median 2.423000 Variance 26.67364 Mode . Range 28.66500 Interquartile Range 3.60000 The SAS System The UNIVARIATE Procedure Variable: NonCityPop_90 (1990 nonmetropolitan pop in million) Basic Statistical Measures Location Variability Mean 1.040429 Std Deviation 0.66036 Median 0.961000 Variance 0.43608 Mode 0.608000 Range 2.75600 Interquartile Range 1.12700

 

Display 10.1: RTF Output of City Population Statistics from PROC UNIVARIATE (Default Basic Statistical Measures Tables)

Display 10.2: RTF Output of Non City Population Statistics from PROC UNIVARIATE (Default Basic Statistical Measures Tables)

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

With the TEMPLATE procedure, you can change many of the table elements and obtain a customized format for the output objects. Here are some of customizations that you can do.

Note: Not all table definition changes affect all destinations. For example, font changes are ignored in the LISTING destination.

The following displays show the results using a customized table definition that changes the first table header attributes, sets underlining and overlining in the table, and changes the amount of spacing between rows.

Output 10.2: Listing Output from PROC UNIVARIATE (Customized Basic Statistical Measures Tables)

The SAS System The UNIVARIATE Procedure Variable: CityPop_90 (1990 metropolitan pop in millions) Basic Statistical Measures Location Variability ______________________________________________________ Mean 3.877020 Std Deviation 5.16465 Median 2.423000 Variance 26.67364 Mode . Range 28.66500 Interquartile Range 3.60000 ______________________________________________________ The SAS System The UNIVARIATE Procedure Variable: NonCityPop_90 (1990 nonmetropolitan pop in million) Basic Statistical Measures Location Variability ______________________________________________________ Mean 1.040429 Std Deviation 0.66036 Median 0.961000 Variance 0.43608 Mode 0.608000 Range 2.75600 Interquartile Range 1.12700 ______________________________________________________

 

Display 10.3: RTF Output from of City Population Statistics PROC UNIVARIATE (Customized Basic Statistical Measures Tables)

Display 10.4: RTF Output from of Non City Population Statistics PROC UNIVARIATE (Customized Basic Statistical Measures Tables)

Comparing the Edit of an Existing Table Definition with Creating a New Table Definition

If you want to change a table definition without completely redefining it, then you use an EDIT statement. When you use the EDIT statement, you keep all the definitions and attributes that already exist in the table definition, and only change the definitions or attributes specified in the EDIT statement. By default, the modified table definition is stored in SASUSER.TEMPLAT with the same name as the table definition that you specified in the EDIT statement.

If you want to create a new table definition, then you use the DEFINE TABLE statement. A table definition cannot be a parent to itself because creating a table through inheritance causes a corrupt template store, and then the definition must be deleted. When you create a new table definition, only the columns , headers, footers, and table attributes that you define exist in the new table definition.

Note: If you edit an existing table, or define a new table with the same name as an existing table, then the table definition will be stored in the SASUSER.TEMPLAT item store and this table definition will be used, by default, unless you specify that the SASHELP.TMPLMST path is searched first.

Категории