The TEMPLATE procedure enables you to customize the appearance of your SAS output. For example, you can create, extend, or modify existing definitions for various types of output:
styles
tables
columns
headers
footers
tagsets
ODS then uses these definitions to produce formatted output.
You can also use the TEMPLATE procedure to navigate and manage the definitions stored in templates stores. Here are some tasks that you can do with PROC TEMPLATE:
edit an existing definition
create links to an existing definition
change the location where you write new definitions
search for existing definitions
view the source code of a definition
The following output shows the use of a customized table definition for the Moments output object from PROC UNIVARIATE. The program used to create the modified table definition
creates and edits a copy of the default table definition.
edits a header within the table definition.
sets column attributes to enhance the appearance of both the HTML and the Listing output.
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 ---------------------------------------------------------------
When you are working with style definitions, you are more likely to modify a style definition that SAS supplies than to write a completely new style definition. The output below uses the Styles.Default definition that SAS provides, but includes changes made to the style definition in order to customize the output's appearance. The Display 7.2 on page 264 shows changes made to both the contents file and the body file in the HTML output. In the contents file, the modified style definition makes changes to the following:
the text of the header and the text that identifies the procedure that produced the output
the colors for some parts of the text
the font size for some parts of the text
the spacing in the list of entries in the table of contents.
In the body file, the modified style definition makes changes to the following:
two of the colors in the color list. One of these colors is used as the foreground color for the table of contents, the byline, and column headers. The other is used for the foreground of many parts of the body file, including SAS titles and footnotes.
the font size for titles and footnotes
the font style for headers
the presentation of the data in the table by changing attributes like cellspacing, rules, and borderwidth.
Tagsets are used to create custom markup. You can create your own tagsets, extend existing tagsets, or modify a tagset definition that SAS supplies. The following display shows the results from a new tagset TAGSET.MYTAGS .
To see the customized CHTML tagset, view the source from your web browser:
These are my new colspecs |
Obs | Name | Sex | Age | Height | Weight |
---|---|---|---|---|---|
1 | Alfred | M | 14 | 69.0 | 112.5 |
2 | Alice | F | 13 | 56.5 | 84.0 |
3 | Baebara | F | 13 | 65.3 | 98.0 |
4 | Carol | F | 14 | 62.8 | 102.5 |
5 | Henry | M | 14 | 63.5 | 102.5 |
6 | James | M | 12 | 57.3 | 83.0 |
7 | Jane | F | 12 | 59.8 | 84.5 |
8 | Janet | F | 15 | 62.5 | 112.5 |
9 | Jeffrey | M | 13 | 62.5 | 84.0 |
10 | John | M | 12 | 59.0 | 99.5 |
11 | Joyce | F | 11 | 51.3 | 50.5 |
12 | Judy | F | 14 | 64.3 | 90.0 |
13 | Louise | F | 12 | 56.3 | 77.0 |
14 | Mary | F | 15 | 66.5 | 112.0 |
15 | Philip | M | 16 | 72.0 | 150.0 |
16 | Robert | M | 12 | 64.8 | 128.0 |
17 | Ronald | M | 15 | 67.0 | 133.0 |
18 | Thomas | M | 11 | 57.5 | 85.0 |
19 | William | M | 15 | 66.5 | 112.0 |