TEMPLATE Procedure: Creating Tabular Output |
PROC TEMPLATE features: |
| ||||||||||||||
Other ODS features: |
| ||||||||||||||
Data set: | Grain_Production. | ||||||||||||||
Format: | $CNTRY.. |
Program Description |
This example creates a template that uses different colors and font attributes for the text inside cells, depending on their values.
Note: This example uses filenames that might not be valid in all operating environments. To successfully run the example in your operating environment, you might need to change the file specifications. See ODS HTML Statements for Running Examples in Different Operating Environments.
Program |
options nodate pageno=1 pagesize=60 linesize=72; title "Leading Grain Producers"; |
proc template; define table shared.cellstyle; |
translate _val_=. into "No data"; |
notes "NMVAR defines symbols that will be used to determine the colors of the cells."; |
nmvar low "Use default style." medium "Use yellow foreground color and bold font weight" high "Use red foreground color and a bold, italic font."; |
classlevels=on; |
define column char_var; generic=on; blank_dups=on; end; |
define column num_var; generic=on; |
justify=on; |
end; run; |
ods html body="CellStyle-Body.htm"; |
%let low=10000; %let medium=50000; %let high=100000; |
data _null_; set grain_production; |
file print ods=( template="shared.cellstyle" |
columns=( char_var=year(generic=on) char_var=country(generic=on format=$cntry.) char_var=type(generic=on) num_var=kilotons(generic=on format=comma12.) ) ); |
put _ods_; run; |
ods html close; |
Listing Output of a Customized Table |
HTML Output of a Customized Table |
HTML Output (Viewed with Microsoft Internet Explorer)
Copyright © 2008 by SAS Institute Inc., Cary, NC, USA. All rights reserved.