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;
|
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; |
|
define column base.template.column;
style={fontstyle=italic};
cellstyle _val_ > 5 as {fontsize=15pt},
_val_ = "Num" as {fontsize=20pt};
end; |
|
define header base.template.header;
style={fontsize=20pt color=purple};
end;
link base.template.footer to base.template.header;
run; |
|
ods html file="MyFile.html" ;
ods select variables;
proc contents data=sashelp.class; run;
ods html close; |
|
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
Copyright © 2008 by SAS Institute Inc., Cary, NC, USA. All rights reserved.