Styles for Graphics


This section provides an overview of the style elements for ODS Graphics. It also describes how to customize a style definition and how to specify a default style for all your output.

Introducing Style Elements for Graphics

An ODS style definition is composed of a set of style elements . A style element is a collection of style attributes that apply to a particular feature or aspect of the output. A value is specified for each attribute in a style definition.

Style definitions control the overall appearance of ODS tables and graphs. For ODS tables, style definitions specify features such as background color, table borders, and color scheme, and they specify the fonts, sizes, and color for the text and values in a table and its headers. For ODS graphs, style definitions specify the following features:

  • background color

  • graph dimensions (height and width). See Example 15.13 for an illustration.

  • borders

  • line styles for axes and grid lines

  • fonts, sizes, and colors for titles, footnotes, axis labels, axis values, and data labels. See Example 15.11 for an illustration.

  • marker symbols, colors, and sizes for data points and outliers

  • line styles for needles

  • line and curve styles for fitted models and predicted values. See Example 15.12 for an illustration.

  • line and curve styles for confidence and prediction limits

  • fill colors for histogram bars, confidence bands, and confidence ellipses

  • colors for box plot features

  • colors for surfaces

  • color ramps for contour plots

In the templates supplied by SAS for ODS graphs, options for plot features are always specified with a style reference of the form style-element:attribute rather than a hard-coded value. For example, the symbol, color, and size of markers for basic scatter plots are specified in a template SCATTERPLOT statement as follows :

  scatterplot x=X y=Y /   markersymbol = GraphDataDefault:markersymbol   markercolor  = GraphDataDefault:contrastcolor   markersize   = GraphDataDefault:markersize;  

This guarantees a common appearance for markers used in all basic scatter plots, which is controlled by the GraphDataDefault element of the style definition that you are using.

In general, the ODS graph features listed above are determined by style element attributes unless they are overridden by a statement or option in the graph template. For example, suppose that a classification variable is specified with the GROUP = option in a template SCATTERPLOT statement such as

  scatterplot x=X y=Y / group=GroupVar;  

Then the colors for markers corresponding to the classification levels are assigned the style element attributes GraphData1:contrastcolor through GraphData12:contrastcolor .

In order to create your own style definition or to modify a style definition for use with ODS Graphics, you need to understand the relationships between style elements and graph features. This information is provided in the section ODS Statistical Graphics and ODS Styles: Usage and Reference (Experimental) at http://support.sas.com/documentation/onlinedoc/base/.

Style definitions are created and modified with the TEMPLATE procedure. For more information, refer to the TEMPLATE Procedure: Creating a Style Definition in the SAS Output Delivery System User s Guide .

Customizing Style Definitions

The default style definitions that SAS provides are stored in the Styles directory of Sashelp.Tmplmst .

You can display, edit, and save style definitions using the same methods available for modifying template definitions, as explained in the sections beginning on page 339. In particular, you can display style definitions using one of these methods :

  • If you are using the Templates window in the SAS windowing environment, expand the Sashelp.Tmplmst node under Templates , and then select Styles to display the contents of this folder.

  • Use the SOURCE statement in PROC TEMPLATE. For example, the following statements display the Journal style definition in the SAS log.

      proc template;   source Styles.Journal;   run;  

Specifying a Default Style

The default style for each ODS destination is specified in the SAS Registry. For example, the default style for the HTML destination is Default, and for the RTF destination it is Rtf.

You can specify a default style for all your output in a particular ODS destination. This is useful if you want to use a different SAS-supplied style, if you have modified one of the SAS-supplied styles (see page 345), or if you have defined your own style. For example, you can specify the Journal style for all your RTF output.

The recommended approach for specifying a default style is as follows. Open the SAS Registry Editor by typing regedit in the command line. Expand the node ODS DESTINATIONS and select a destination (for example, select RTF ). Double-click the Selected Style item, as illustrated in Figure 15.15, and specify a style. This can be any SAS-supplied style or a user-defined style, as long as it can be found with the current ODS path (for example, specify Journal ). You can specify a default style for the HTML, MARKUP, and PRINTER destinations in a similar way.

click to expand
Figure 15.15: SAS Registry Editor

Note: ODS searches sequentially through each element of the ODS PATH list for the first style definition that matches the name of the style specified in the SAS Registry. The first style definition found is used. If you are specifying a customized style as your default style, the following are useful suggestions:

  • If you save your style in Sasuser.Templat , verify that the name of your default style matches the name of the style specified in the SAS Registry. For example suppose the Rtf style is specified for the RTF destination in the SAS Registry. You can name your style Rtf and save it in Sasuser.Templat .Thisblocksthe Rtf style in Sashelp.Tmplmst .

  • If you save your style in a user-defined template store, verify that this template store is the first in the current ODS PATH list. Include the ODS PATH statement in your SAS autoexec file so that it is executed at startup.

For the HTML destination, an alternative approach for specifying a default style is as follows. From the menu at the top of the main SAS window select Tools Options Preferences . Inthe Results tab check the Create HTML box and select a style from the pull-down menu. This is illustrated in Figure 15.16.

click to expand
Figure 15.16: Selecting a Default Style for HTML Destination



SAS.STAT 9.1 Users Guide (Vol. 1)
SAS/STAT 9.1 Users Guide, Volumes 1-7
ISBN: 1590472438
EAN: 2147483647
Year: 2004
Pages: 156

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net