PROC TEMPLATE features: |
DEFINE STYLE statement
| PARENT= attribute |
| REPLACE statement |
| style attributes
| user-defined
attributes |
| BACKGROUND= |
| BORDERCOLORDARK= |
| BORDERCOLORLIGHT= |
| BORDERWIDTH= |
| CELLPADDING= |
| CELLSPACING= |
| FONT= |
| FONT_STYLE= |
| FOREGROUND= |
| FRAME= |
| POSTHTML= |
| RULES= | | |
|
Other ODS features: |
ODS HTML statement
|
ODS LISTING statement |
ODS PATH statement |
|
Data set: |
ENERGY
|
Formats: |
DIVFMT. and USETYPE.
|
Generally, when you are working with style
definitions, you are
more likely to modify a style definition that SAS Institute supplies than
to write a completely new style definition. This example shows you how to
make changes to the default style definition for the HTML destination. The
new style definition affects both the body file and the contents file in the
HTML output. In particular, in the body file, it makes changes to
- two of the colors in the color list. One of these colors is used
as the foreground color for the table of contents, the byline, and column
headers. The other is used for the foreground of many parts of the body file,
including SAS titles and footnotes.
- the font size for titles and footnotes
- the font style for headers
- the presentation of
the data in the table by changing attributes
like cellspacing, rules, and borderwidth.
In the contents file, the style definition makes changes to
- the text of the header and
the text that identifies the procedure
that produced the output
- the colors for some parts of the text
- the font size of some parts of the text
- the spacing in the
list of entries in the table of contents.
Note: Remember that when a STYLE statement creates
a style element in the new style definition, only style elements that explicitly
inherit from that style element in the new definition inherit the change.
When a REPLACE statement creates a style element in the new style definition,
all style elements that inherit from that element inherit the definition that
is in the new style definition, so the change appears in all children of the
element.
| ods path sasuser.templat(update) sashelp.tmplmst(read); |
| ods listing close; |
| ods html body='sasdefaultstyle-body.htm'
contents='sasdefaultstyle-content.htm'
frame='sasdefaultstyle-frame.htm'
style=styles.default; |
| title 'Energy Expenditures for Each Region';
title2 '(millions of dollars)';
footnote "Report prepared on &sysdate9"; |
| proc print data=energy noobs;
var state type expenditures;
format division divfmt. type usetype. expenditures comma12.;
by division;
where division=2 or division=3;
run; |
HTML Output from PROC PRINT with the Default Style Definition
| proc template;
define style customdefault; |
| parent=styles.default; |
| replace color_list /
'fgB2' = cx0066AA
'fgB1' = cx004488
'fgA4' = cxAAFFAA
'bgA4' = cx880000
'bgA3' = cxD3D3D3
/* changed from cx0033AA */
'fgA2' = cx0000FF
'bgA2' = cxB0B0B0
'fgA1' = cx000000
'bgA1' = cxF0F0F0
/* changed from cx002288 */
'fgA' = cx660099
'bgA' = cxE0E0E0; |
| replace titlesandfooters /
foreground=colors("systitlefg")
background=colors("systitlebg")
font=fonts("titlefont2") font_size=3; |
| replace byline from titlesandfooters /
foreground=colors("headerfg"); |
| style header from header /
font_style=italic; |
| replace text /
"prefix1" = "PROC "
"suffix1" = ":"
"Content Title" = "Contents"
"Pages Title" = "Pages"
"Note Banner" = "Note:"
"Warn Banner" = "Warning:"
"Error Banner" = "Error:"
"Fatal Banner" = "Fatal:"
; |
| style table from table /
rules=cols
cellspacing=0
bordercolorlight=colors("headerfg")
bordercolordark=colors("systitlefg")
borderwidth=5; |
| style contents from contents /
visitedlinkcolor=colors("systitlefg")
foreground = colors('systitlefg'); |
| style contentitem from contentitem /
posthtml='<p>'; |
| end;
run; |
| ods html body='customdefaultstyle-body.htm'
contents='customdefaultstyle-content.htm'
frame='customdefaultstyle-frame.htm'
style=customdefault; |
| title 'Energy Expenditures for Each Region';
title2 '(millions of dollars)';
footnote "Report prepared on &sysdate9"; |
| proc print data=energy noobs;
var state type expenditures;
format division divfmt. type usetype. expenditures comma12.;
by division;
where division=2 or division=3;
run; |
| ods html close;
ods listing; |
HTML Output from PROC PRINT with the Customized Style Definition
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.