Attributes as Collections of Related Options

Overview

In GTL, the syntax for explicitly setting the properties of a graphical feature is a list of name-value pairs that is enclosed in parentheses. For example, to set the X-axis properties, you use the following:
XAXISOPTS=(LABEL="string" TYPE=axis-type ...)
The syntax for setting appearance options is similar. For example, statements such as SERIESPLOT, DENSITYPLOT, REFERENCELINE, DROPLINE, and several others have a LINEATTRS= option:
LINEATTRS= (COLOR=color PATTERN=line-pattern THICKNESS=line-thickness)
As a matter of fact, the properties of any line that you can draw in GTL are specified in exactly the same way, possibly with a different option keyword.
For BANDPLOT and MODELBAND statements, you would use the following option:
OUTLINEATTRS=(COLOR=color PATTERN=line-pattern THICKNESS=line-thickness)
For the BOXPLOT statement, you could use either of the following options:
WHISKERATTRS=(COLOR=color PATTERN=line-pattern THICKNESS=line-thickness)
MEDIANATTRS=(COLOR=color PATTERN=line-pattern THICKNESS=line-thickness)
The list of common options is sometimes called an "attribute bundle." An interesting feature of attribute bundles for appearance-related options is that there are several ways of setting the values of the sub-options:

LINEATTRS Option

The following syntax is the complete syntax for the LINEATTRS= option:
LINEATTRS = style-element | style-element (line-options) | (line-options)
By default, a style-element is used for the LINEATTRS= setting. For the REFERENCELINE and DROPLINE statements, the default style element is the GraphReference element. What exactly does this mean?
If we look up the GraphReference element in the DEFAULT style (see SAS Graph Style Elements for GTL for a complete list of all elements and attributes and their defaults), we find the following:
style GraphReference /
  linethickness = 1px
  linestyle = 1
  contrastcolor = GraphColors('greferencelines');
This definition is ODS style syntax for an attribute bundle. The following table shows how this definition's style attributes map to GTL options.
Style Attribute
Description
GTL Suboption
Description
LINETHICKNESS
dimension, most often pixels
THICKNESS
dimension, most often pixels
LINESTYLE
numeric; 1 to 46, 1 being a solid line
PATTERN
either 1 to 46 or a pattern name, such as SOLID, DASH, DOT (see Values for Line Patterns for examples of available line patterns)
CONTRASTCOLOR
color specification
COLOR
color specification
The default specification for REFERENCELINE and DROPLINE statements is LINEATTRS=GraphReference, which is a shortcut meaning "initialize the three GTL line properties with the corresponding attributes that are defined in a style element." This can be explicitly expressed in GTL as follows:
LINEATTRS=( PATTERN  = GraphReference:LineStyle
            THICKNESS= GraphReference:LineThickness
            COLOR    = GraphReference:ContrastColor )
In GTL, a style reference is a construct of the form style-element : style-attribute. This convention is the way to refer to a specific style attribute of a specific style element.
First of all, let's look at what it means to use a different style element for the LINEATTRS= option.
When selecting a different style element, you should make sure that the style element does set line properties (graph style elements do not necessarily define all possible attributes). Some reasonable choices might be GraphDataDefault, GraphAxisLines, GraphGridLines. and GraphBorderLines. You might choose GraphGridLines to force a reference line to match the properties of grid lines (if displayed). When you make this kind of assignment, you really don't know what actual line properties will be used because they might change, depending on how a given style is defined. What you should be confident of is that the grid lines and reference lines will be identical in terms of line properties.
Now let's assume that you want reference lines to be somewhat like a style element, but nevertheless different. This involves an override. Here are some examples:
1) LINEATTRS=GraphGridLines(THICKNESS=2px)
2) LINEATTRS=GraphAxisLines(PATTERN=DASH)
3) LINEATTRS=GraphReference(COLOR=GraphAxisLines:ContrastColor)
4) LINEATTRS=(COLOR=GraphAxisLines:ContrastColor)
5) LINEATTRS=(COLOR=BLUE)
In example 1, the reference line will look like a grid line (color and pattern), but be thicker (assuming most styles define grid lines as 1px).
In example 2, the reference line will look like an axis line (color and thickness), but it will use the DASH pattern.
In example 3, the reference line will look like a reference line (pattern and thickness), but it will have the color of axis lines.
Example 4 is a short form for example 3. Any time that you don't supply a style element or don’t override all the sub-options, the sub-options not overridden come from the default style references.
Example 5 shows how you can "hard-code" visual properties. This technique is a straightforward way of getting what you want. The results might look good when the DEFAULT or LISTING styles are in effect, but might not look good when the ANALYSIS style is in effect because ANALYSIS does not use any blues in its color scheme.
When specifying the attributes for a line, the available line-options can be any one or more of the following settings. The options must be enclosed in parentheses, and each option is specified as a name = value pair. In all cases, the value can be a style-reference in the form style-element:style-attribute (see Example 3).
COLOR= style-reference | color
specifies the line color. If you use a style-reference, the style-attribute should be a valid attribute, such as COLOR, CONTRASTCOLOR, STARTCOLOR, NEUTRAL, or ENDCOLOR. The convention is to use CONTRASTCOLOR for lines.
PATTERN=style-reference | line-pattern-name | line-pattern-number
specifies the line pattern. If you use a style-reference, the style-attribute should be LINESTYLE. Line patterns can be specified as a pattern name or pattern number. See Values for Marker Symbols and Line Patterns for a list of all possible line patterns.
THICKNESS=style-reference | dimension
specifies the line thickness. If you use a style-reference, the style-attribute should be LINETHICKNESS.

MARKERATTRS Option

Much of what is said about line properties in LINEATTRS Option also applies to marker properties. Some plot statements, such as SERIESPLOT, display a line and can display markers. In those cases, you should use the DISPLAY=(MARKERS) option to turn on the marker display, and also use the MARKERATTRS= option to control the appearance of markers. (The BOXPLOT statement uses OUTLIERATTRS= and MEANATTRS= options).
The following syntax is the complete syntax for the MARKERATTRS= option:
MARKERATTRS=style-element | style-element (marker-options) | (marker-options)
The following marker-options are available:
COLOR= style-reference | color
SYMBOL= style-reference | marker-name
SIZE= style-reference | marker-size
The following table shows how MARKERATTRS= style attributes map to GTL options.
Style Attribute
Description
GTL Suboption
Description
CONTRASTCOLOR
color specification
COLOR
color specification
MARKERSIZE
dimension, most often pixels
SIZE
dimension, most often pixels
MARKERSYMBOL
string—for example, "circle" or "square"
SYMBOL
predefined keywords such a CIRCLE, SQUARE, TRIANGLE
none
WEIGHT
NORMAL or BOLD
COLOR= style-reference | color
specifies the line color. If you use a style-reference, the style-attribute should be a valid attribute such as COLOR, CONTRASTCOLOR, STARTCOLOR, NEUTRAL, or ENDCOLOR. The convention is to use CONTRASTCOLOR for lines.
SYMBOL=style-reference | marker-name
specifies the marker symbol. If you use a style-reference, the style-attribute should be MARKERSYMBOL. Markers are specified by keywords. See Values for Marker Symbols and Line Patterns for a list of all possible markers and their keywords.
SIZE= style-reference | dimension
specifies the marker size. If you use a style-reference, the style-attribute should be MARKERSIZE.
WEIGHT = NORMAL | BOLD
specifies the marker weight. NORMAL is the default. BOLD makes markers appear heavier or denser.

TEXTATTRS Option

The appearance of all text that appears in a graph can be controlled by the style or with GTL syntax. Title and footnote text in a graph is specified with the ENTRYTITLE and ENTRYFOOTNOTE statements. One or more lines of text can be displayed in the plot area by using one or more ENTRY statements. Each of these statements provides the TEXTATTRS= option for controlling the appearance of that text.
The following syntax is the complete syntax for the TEXTATTRS= option:
TEXTATTRS=style-element | style-element (text-options) | (text-options)
Most often the TEXTATTRS=(text-options) settings are used to control text font and color properties.
Text can also be specified on numerous options that are available on plot statements and layout statements, and also on various axis options. For example, most plot statements that can display a line provide the CURVELABEL= for labeling the line. Axis options that are available for the layout statements provide the LABEL= option for specifying an axis label. The default appearance of the text in these cases is controlled by styles, but GTL syntax provides the CURVELABELATTRS= and LABELATTRS= options for overriding the defaults. The syntax and use for these options is similar to that of the TEXTATTRS= option. For example, the following syntax is the complete syntax for the LABELATTRS= option:
LABELATTRS=style-element | style-element (text-options) | (text-options)
Changing text attributes is fully discussed in Adding and Changing Text in a Graph.