TEMPLATE Procedure: Creating Tabular Output |
PROC TEMPLATE features: |
DEFINE TABLE statement:
|
CELLSTYLE AS statement:
|
_STYLE_ variable |
|
_ROW_ variable | | |
DEFINE COLUMN statement:
|
CELLSTYLE AS statement:
|
|
STYLE= column attribute statement | |
DEFINE HEADER
statement:
|
STYLE= column attribute statement | |
LINK statement |
|
Other ODS features: |
ODS HTML statement
|
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.
title;
options nodate nostimer LS=78 PS=60;
ods listing close;
![Note about code](../../../../common/61991/HTML/default/images/snbut.gif) |
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](../../../../common/61991/HTML/default/images/snbut.gif) |
define column base.template.column;
style={fontstyle=italic};
cellstyle _val_ > 5 as {fontsize=15pt},
_val_ = "Num" as {fontsize=20pt};
end; |
![Note about code](../../../../common/61991/HTML/default/images/snbut.gif) |
define header base.template.header;
style={fontsize=20pt color=purple};
end;
link base.template.footer to base.template.header;
run; |
![Note about code](../../../../common/61991/HTML/default/images/snbut.gif) |
ods html file="MyFile.html" ;
ods select variables;
proc contents data=sashelp.class; run;
ods html close; |
![Note about code](../../../../common/61991/HTML/default/images/snbut.gif) |
proc template;
delete base.template.table;
delete base.template.column;
delete base.template.header;
delete base.template.footer;
run; |
Using Master Templates For HTML Output
![[Using Master Templates For HTML Output]](images/mastertemplate.gif)
Copyright © 2008 by SAS Institute Inc., Cary, NC, USA. All rights reserved.