Chapter Contents

Previous

Next
The TEMPLATE Procedure

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


PROC TEMPLATE features:
EDIT statement
Header attributes
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

Note:   This example uses file names that may not be valid in all operating environments. To successfully run the example in your operating environment, you may need to change the file specifications. See Alternative ODS HTML Statements for Running Examples in Different Operating Environments.  [cautionend]


Program 1: Using the Table Definition that SAS Provides

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


Default Listing Output

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


Default HTML Output

HTML Output from PROC UNIVARIATE (Default Moments Table)
[HTML Output]


Program 2: Using a Customized Table Definition

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


Customized Listing Output

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


Customized HTML Output

[HTML Output]


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.