SAS 9.1 Output Delivery System Users Guide

Introduction

Why Use the TEMPLATE Procedure?

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:

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:

What Can You Do with the TEMPLATE Procedure?

Modify a Table Definition that a SAS Procedure Uses

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

Output 7.1: Listing Output (Customized Moments Table) from PROC UNIVARIATE

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 ---------------------------------------------------------------

 

Display 7.1: Customized HTML Output (Customized Moments Table) from PROC UNIVARIATE (Viewed with Microsoft Internet Explorer)

Modify a Style Definition

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:

Display 7.2: HTML Output (Viewed with Microsoft Internet Explorer)

In the body file, the modified style definition makes changes to the following:

Create Your Own Tagset

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:

  • Select from your browser's tool bar:

    View – Source

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

Display 7.3: MYTAGS.CHTML Output (Viewed with Microsoft Internet Explorer)

Категории