Chapter Contents |
Previous |
Next |
The TEMPLATE Procedure |
PROC TEMPLATE features: |
| ||||||||||||||
Other ODS features: |
| ||||||||||||||
Data set: | GRAIN_PRODUCTION | ||||||||||||||
Format: | $CNTRY. |
This example creates a template that uses different colors for the text inside cells, depending on their values.
Note: This example uses file names that may not be valid
in all operating environments. To successfully run the example in your operating
environment, you may need to change the file specifications. See Alternative 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"; notes "to determine the colors of the cells."; |
nmvar low 'Use default style.' medium 'Use yellow foreground and bold font weight' high 'Use red foreground 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 |
HTML Output |
Both the table customizations and the style customizations appear in
the HTML output. Table customizations include the suppression of values that
do not change from one row to the next and the translation of missing values
to No data . The style customizations include
the colors and font styles that are specified in the CELLSTYLE-AS statement.
|
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.