Statistical Graphics Using ODS

Style Elements and Attributes

An ODS style template is composed of a set of style elements. A style element is a collection of style attributes that applies to a particular feature or aspect of the output. A value is specified for each attribute in a style template. For example, GraphFit is the style element used for fit lines, and its attributes include: LineThickness, LineStyle, MarkerSize, MarkerSymbol, ContrastColor, and Color.

In general, style templates control the overall appearance of ODS tables and graphs. For tables, style templates 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 graphs, style templates specify the following features:

  • background color

  • graph dimensions (height and width)

  • borders

  • line styles for axes and grid lines

  • fonts, sizes, and colors for titles, footnotes, axis labels, axis values, and data labels (see the section Modifying Graph Fonts in Styles 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 the section Modifying Other Graph Elements in Styles 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

The SAS System supplies a graph template for each graph that is created by statistical procedures. A graph template is a program that specifies the layout and details of a graph. See the section Graph Templates in ChapterĀ 22: ODS Graphics Template Modification, for more information about templates. Some template options are specified with a style reference of the form style-element, or occasionally style-element:attribute. 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 / markerattrs=GraphDataDefault;

The preceding statement specifies that the appearance for markers is controlled by the GraphDataDefault element. Consistent use of this element guarantees a common appearance of markers across all scatter plots, based on the style template that you are using.

In general, ODS Graphics features 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 SCATTERPLOT template statement as follows:

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

Then the colors for markers that correspond to the classification levels are assigned by using the style element attributes GraphData1:ContrastColor through GraphData12:ContrastColor.

Style templates are created and modified with PROC TEMPLATE. For more information, see the SAS Output Delivery System: User's Guide. You need to understand the relationships between style elements and graph features if you want to create your own style template or modify a style template. These relationships are explained in the following sections.