SAS 9.1 Output Delivery System Users Guide

Viewing the Contents of a Style Definition

To view the contents of a style definition, you can use the SAS windowing environment, the command line, or the TEMPLATE procedure.

The Default Style Definition for HTML and Markup Languages

Where Is the Default Style Definition for HTML and Markup Languages?

The default style definition for the HTML and markup languages destinations are stored in STYLES.DEFAULT in the template store SASHELP.TMPLMST. You can view the style definition from the TEMPLATE window, or you can submit this PROC TEMPLATE step to write the style definition to the SAS log:

proc template; source styles.default; run;

Modifying Style Elements in the Default Style Definition for HTML and Markup Languages

When you are working with style definitions, you are more likely to modify a SAS style definition than to write a completely new style definition. Example 3 on page 355 shows you how to modify the default style definition.

When you want to customize the style definition for use at your site, it is helpful to know what each style element in the style definition specifies. For a list of the default HTML and markup languages style elements, see Appendix 4, 'HTML, Printer Family, and Markup Languages Style Elements and Their Inheritances,' on page 651.

Note: The default style definition for the PRINTER destination is stored in STYLES.PRINTER in the template store SASHELP.TMPLMST. Similarly, the default style definition for the RTF destination is stored in STYLES.RTF in the template store SASHELP.TMPLMST.

ODS Styles with Graphical Style Information

SAS provides ODS styles that incorporate graph style information. See 'Viewing the Contents of a Style Definition' on page 319 for information about viewing the code for the ODS styles delivered with SAS. In addition to using defined ODS styles, you can also modify an existing style or create an entirely new style using the new graph style elements. Example 4 on page 361 describes how a defined ODS style was generated. See 'Style Attributes and Their Values' on page 292 for a complete listing of style attributes. For a complete list of style elements see Appendix 4, 'HTML, Printer Family, and Markup Languages Style Elements and Their Inheritances,' on page 651.

Note: The graph styles (attributes and elements) are at the bottom of the style attributes and style elements tables.

While graph styles utilize a number of attributes that are also used by other styles generated with PROC TEMPLATE, several attributes are unique to graph styles. For example, you can use STARTCOLOR and ENDCOLOR to produce a gradient effect that gradually changes from the starting color to the ending color in a specified element. When only either a STARTCOLOR or ENDCOLOR, but not both, is specified, then the attribute that was not specified is transparent when TRANSPARENCY is being used. In Example 4 on page 361, only an ENDCOLOR is specified; therefore, the starting color is transparent.

TRANSPARENCY is another attribute unique to graph styles. With transparency, you can specify the level of transparency (from 0.0 to 1.0) to indicate the percentage of transparency (0 to 100 %) for the graph element. While you can use BACKGROUNDIMAGE in other styles to stretch an image, in graph styles you can also use IMAGE to position or tile an image.

With graph styles you can also combine images and colors to create a blending affect. The blending works best when you use a grayscale image with a specified color. Blending can be done in the following elements: GraphLegendBackground, GraphCharts, GraphData#, GraphFloor, and GraphWalls. To blend, specify a color using the BACKGROUND or FOREGROUND attribute and specify an image using the BACKGROUNDIMAGE or IMAGE attribute.

Note: When using the GraphData# element, you can use the FOREGROUND attribute, but not the BACKGROUND attribute to specify a color value.

About Style Definition Inheritance and Style Element Inheritance

Definitions

To help you become familiar with style definition inheritance and style element inheritance, let's review the definitions of a style definition and a style element.

style definition

describes how to display the presentation aspects (color, font, font size , and so on) of the output for an entire SAS job. A style definition determines the overall appearance of the documents that use it. Each style definition is composed of style elements.

style element

is a collection of style attributes that apply to a particular part of the output for a SAS job. For example, a style element may contain instructions for the presentation of column headers or for the presentation of the data inside cells . Style elements may also specify default colors and fonts for output that uses the style definition. Each style attribute specifies a value for one aspect of the presentation. For example, the BACKGROUND= attribute specifies the color for the background of an HTML table, and the FONT_STYLE= attribute specifies whether to use a Roman, a slant, or an italic font.

When you use PROC TEMPLATE to create style definitions, it is important to understand inheritance. There are two types of inheritance:

style definition inheritance

style element inheritance

Note: For a list of the default style elements used for HTML and markup languages and their inheritance, see Appendix 4, 'HTML, Printer Family, and Markup Languages Style Elements and Their Inheritances,' on page 651.

How to Determine Style Definition Inheritance

A style definition determines the overall appearance of the documents that use it. Each style definition is composed of style elements. A style definition is created with the DEFINE STYLE statement and its substatements and attributes.

The PARENT= attribute, used with the DEFINE STYLE statement, determines style definition inheritance. When you specify a parent for a style definition, all the style elements, attributes, and statements that are specified in the parent's definition are used in the new definition unless the new definition overrides them.

How to Determine Style Element Inheritance

The STYLE and REPLACE statements, used with the DEFINE STYLE statement, determine style element inheritance. They augment or override the attributes of a particular style element. You can use the STYLE statement in either a style definition that has no parent or a style definition that has a parent. However, you can use the REPLACE statement only in a style definition that has a parent.

Creating a Style Definition with No Parent, Using Style Element Inheritance

This section explains style definition inheritance and style element inheritance, beginning with the simpler case of style element inheritance in a style definition that has no parent and progressing to more complicated cases. The focus here is on PROC TEMPLATE and the DEFINE STYLE statement, so only the PROC TEMPLATE code that creates the style definitions appears in the text. However, in order to produce the HTML output that is shown here, it is necessary to create a customized table and to bind that table to a data set. The complete code that produces each piece of output is in 'Programs that Illustrate Inheritance' on page 622.

Summary of Style Element Inheritance in a Style Definition with No Parent

The following points summarize style element inheritance in a style definition that does not have a parent:

Creating a Style Definition with a Parent Using Style Element Inheritance

Creating a Style Element in a Style Definition with a Parent

Modifying Existing Style Elements with a Parent

When you create a new style definition from a parent style definition you can, in addition to adding new style elements, modify existing style elements. There are two ways to do this:

The following programs show the results of these methods.

Summary of Style Element Inheritance in a Style Definition with a Parent

The following points summarize style element inheritance in a style definition that has a parent:

Категории