The TEMPLATE Procedure

Example 1: Customizing a Table Definition that a SAS Procedure Uses

PROC TEMPLATE features:
EDIT statement
 JUST= STYLE=
Table attributes
 DOUBLE_SPACE= OVERLINE= UNDERLINE=
Other ODS features:
 ODS HTML statement ODS SELECT statement
Data set: STATEPOP

This example customizes the table definition for the Moments output object from PROC UNIVARIATE. The first program uses the table definition that SAS Institute supplies to generate both Listing and HTML output of the Moments object.

The second program

• Creates and edits a copy of the default template.

• Edits a header within the template.

• Sets column attributes to enhance the appearance of both the HTML and the Listing output.

 `options nodate pageno=1 pagesize=60 linesize=72;`
 `ods html body='defaultmoments-body.htm';`
 `ods select moments;`
 ```proc univariate data=statepop mu0=3.5; var citypop_90; title 'Default Moments Table'; run;```
 ` ods html close;`

Listing Output from PROC UNIVARIATE (Default Moments Table)
 ``` Default Moments Table 1 The UNIVARIATE Procedure Variable: CityPop_90 (1990 metropolitan pop in millions) Moments N 51 Sum Weights 51 Mean 3.87701961 Sum Observations 197.728 Std Deviation 5.16465302 Variance 26.6736408 Skewness 2.87109259 Kurtosis 10.537867 Uncorrected SS 2100.27737 Corrected SS 1333.68204 Coeff Variation 133.21194 Std Error Mean 0.72319608```

 `ods path sasuser.templat(update) sashelp.tmplmst(read);`
 ```proc template; edit base.univariate.moments;```
 ``` double_space=on; underline=on; overline=on; ```
 ` edit head;`
 ` style=header{foreground=green font_style=italic};`
 ` just=left;`
 ``` end; end; run;```
 `ods html body='custommoments-body.htm';`
 `ods select moments;`
 ```proc univariate data=statepop mu0=3.5; var citypop_90; title 'Custom Moments Table'; run;```
 `ods html close;`

Listing Output from PROC UNIVARIATE (Customized Moments Table)
 ``` Custom Moments Table 1 The UNIVARIATE Procedure Variable: CityPop_90 (1990 metropolitan pop in millions) Moments --------------------------------------------------------------- N 51 Sum Weights 51 Mean 3.87701961 Sum Observations 197.728 Std Deviation 5.16465302 Variance 26.6736408 Skewness 2.87109259 Kurtosis 10.537867 Uncorrected SS 2100.27737 Corrected SS 1333.68204 Coeff Variation 133.21194 Std Error Mean 0.72319608 ---------------------------------------------------------------```