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. ![[cautionend]](../common/images/cautend.gif)
![Note about code](../common/images/snbut.gif) | ods path sasuser.templat(update) sashelp.tmplmst(read); |
![Note about code](../common/images/snbut.gif) | ods listing close; |
![Note about code](../common/images/snbut.gif) | ods html body='sasdefaultstyle-body.htm'
contents='sasdefaultstyle-content.htm'
frame='sasdefaultstyle-frame.htm'
style=styles.default; |
![Note about code](../common/images/snbut.gif) | title 'Energy Expenditures for Each Region';
title2 '(millions of dollars)';
footnote "Report prepared on &sysdate9"; |
![Note about code](../common/images/snbut.gif) | 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
![Note about code](../common/images/snbut.gif) | proc template;
define style customdefault; |
![Note about code](../common/images/snbut.gif) | parent=styles.default; |
![Note about code](../common/images/snbut.gif) | 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; |
![Note about code](../common/images/snbut.gif) | replace titlesandfooters /
foreground=colors("systitlefg")
background=colors("systitlebg")
font=fonts("titlefont2") font_size=3; |
![Note about code](../common/images/snbut.gif) | replace byline from titlesandfooters /
foreground=colors("headerfg"); |
![Note about code](../common/images/snbut.gif) | style header from header /
font_style=italic; |
![Note about code](../common/images/snbut.gif) | replace text /
"prefix1" = "PROC "
"suffix1" = ":"
"Content Title" = "Contents"
"Pages Title" = "Pages"
"Note Banner" = "Note:"
"Warn Banner" = "Warning:"
"Error Banner" = "Error:"
"Fatal Banner" = "Fatal:"
; |
![Note about code](../common/images/snbut.gif) | style table from table /
rules=cols
cellspacing=0
bordercolorlight=colors("headerfg")
bordercolordark=colors("systitlefg")
borderwidth=5; |
![Note about code](../common/images/snbut.gif) | style contents from contents /
visitedlinkcolor=colors("systitlefg")
foreground = colors('systitlefg'); |
![Note about code](../common/images/snbut.gif) | style contentitem from contentitem /
posthtml='<p>'; |
![Note about code](../common/images/snbut.gif) | end;
run; |
![Note about code](../common/images/snbut.gif) | ods html body='customdefaultstyle-body.htm'
contents='customdefaultstyle-content.htm'
frame='customdefaultstyle-frame.htm'
style=customdefault; |
![Note about code](../common/images/snbut.gif) | title 'Energy Expenditures for Each Region';
title2 '(millions of dollars)';
footnote "Report prepared on &sysdate9"; |
![Note about code](../common/images/snbut.gif) | 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; |
![Note about code](../common/images/snbut.gif) | 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.