TEMPLATE Procedure: Creating Tabular Output |
PROC TEMPLATE features: |
DEFINE STYLE statement:
|
DEFINE TABLE statement:
|
DEFINE COLUMN statement:
|
DEFINE HEADER statement:
|
|
Other ODS features: |
FILE statement with ODS= option |
ODS HTML statement:
|
ODS PDF statement:
|
PUT statement with _ODS_
argument |
ODS TRACE statement |
|
Data set: |
See Creating the Exprev Data Set.
|
This example combines a customized style with a customized
table template to produce output with a checkerboard pattern of table cells.
options obs=20;
title;
|
proc template;
define style greenbar; |
|
parent=styles.printer; |
|
replace headersandfooters from cell /
backgroundcolor=light green
color=black
fontsize=3
fontweight=bold
; |
|
end;
run; |
|
ods html body="greenbar.html" style=greenbar;
ods pdf file="greenbar.pdf" style=greenbar; |
|
proc template;
define table Checkerboard; |
|
cellstyle mod(_row_,2) && mod(_col_,2) as data{backgroundcolor=yellow fontweight=bold },
not(mod(_row_,2)) && not(mod(_col_,2)) as data{backgroundcolor=yellow fontweight=bold },
1 as data; |
|
define header top;
text "Checkerboard Table Template";
end; |
|
define column country;
dataname=country;
define header bar;
text "Country";
end;
header=bar;
end; |
|
define column OrderDate;
dataname=Order_Date;
define header bar;
text "Order Date";
end;
header=bar;
end; |
|
define column ShipDate;
dataname=Ship_Date;
define header bar;
text "Ship Date";
end;
header=bar;
end; |
|
define column SaleType;
dataname=Sale_Type;
define header bar;
text "Sale Type";
end;
header=bar;
end; |
|
end;
run; |
|
data _null_;
set work.exprev; |
|
file print ods=(template="Checkerboard");
put _ods_;
run; |
|
ods html close;
ods pdf close; |
HTML Output (Viewed with Internet Explorer 6.0)
PDF Output (Viewed with Acrobat Reader 5.0)
Copyright © 2008 by SAS Institute Inc., Cary, NC, USA. All rights reserved.