Previous Page | Next Page

TEMPLATE Procedure: Creating Tabular Output

Example 6: Creating Master Templates


PROC TEMPLATE features:

DEFINE TABLE statement:

CELLSTYLE AS statement:

_STYLE_ variable

_ROW_ variable

DEFINE COLUMN statement:

CELLSTYLE AS statement:

_VAL_ variable

STYLE= column attribute statement

DEFINE HEADER statement:

STYLE= column attribute statement

LINK statement

Other ODS features: ODS HTML statement


Program Description

The following program creates four master templates for tables: Base.Template.Table, Base.Template.Column, Base.Template.Header, and Base.Template.Footer. These templates contain style information that creates alternating blue and green row colors and specific styles for headers and footers. Once they are created, master templates are applied to every table created by SAS until you specifically remove the master template or it is overridden by another table template created by PROC TEMPLATE.


Program

title;
options nodate nostimer LS=78 PS=60;
ods listing close;

 Note about code
proc template;
define table base.template.table;
   cellstyle mod(_row_, 2) and _style_ ^= "RowHeader" as {background=blue color=white},
             mod(_row_, 2) and _style_ = "RowHeader" as {background=green color=white};
end;
 Note about code
define column base.template.column;
   style={fontstyle=italic};
   cellstyle _val_ > 5 as {fontsize=15pt},
             _val_ = "Num" as {fontsize=20pt};
end;
 Note about code
define header base.template.header;
   style={fontsize=20pt color=purple};
end;
link base.template.footer to base.template.header;
run;
 Note about code
ods html file="MyFile.html" ;
ods select variables;
proc contents data=sashelp.class; run;

ods html close;
 Note about code
proc template;
delete base.template.table;
delete base.template.column;
delete base.template.header;
delete base.template.footer;

run;

Output

Using Master Templates For HTML Output

[Using Master Templates For HTML Output]

Previous Page | Next Page | Top of Page