Here is example output.
Other statements such as DENSITYPLOT, REGRESSIONPLOT, LOESSPLOT,
PBSPLINEPLOT, MODELBAND, REFERENCELINE, and DROPLINE are
"specialized" in the sense that their default line appearance is governed by other style
elements such as GraphFit, GraphConfidence, GraphPrediction, GraphReference, or
some other specialized style element. When these statements are used in conjunction
with the "non-specialized" plot statements, there are differences in appearance.
Controlling the Appearance of Grouped Data
Plots That Support Grouped Data
The GROUP= column option is used to plot data when a classification or grouping
variable is available. Plots that support the GROUP= option include the following:
AXISTABLE HEATMAPPARM PIECHART
BANDPLOT HIGHLOWPLOT POLYGONPLOT
BARCHART LINECHART REGRESSIONPLOT
BARCHARTPARM LINEPARM SCATTERPLOT
BOXPLOT LOESSPLOT SCATTERPLOTMATRIX
BOXPLOTPARM MODELBAND SERIESPLOT
BUBBLEPLOT MOSAICPLOTPARM STEPPLOT
ELLIPSEPARM NEEDLEPLOT VECTORPLOT
FRINGEPLOT PBSPLINEPLOT WATERFALLCHART
Starting with the second maintenance release of SAS 9.4, the DENSITYPLOT,
ELLIPSE, and HISTOGRAM statements also support the GROUP= option.
452 Chapter 23 Managing Your Graph’s Appearance
Using the Default Appearance for Grouped Data
By default, the GROUP= option automatically uses the style elements GraphData1–
GraphDataN for the presentation of each unique group value. Consider the following
template for a series plot that displays grouped data.
Example Code 23.1 Template for a Grouped Series Plot
proc template;
define statgraph groupedseries;
begingraph;
entrytitle "Tech Stocks 2002-2004";
entryfootnote halign=left "Source: SASHELP.STOCKS";
layout overlay;
seriesplot x=date y=close / group=stock name="series"
lineattrs=(thickness=2);
discretelegend "series";
endlayout;
endgraph;
end;
run;
Executing this template with the default ODS style HTMLBLUE generates the following
output.
proc sgrender data=sashelp.stocks template=groupedseries;
where date between "1jan02"d and "31dec04"d;
run;
Attributes such as line color and pattern are used to display the group values. The
attributes are defined by the GraphData1–GraphDataN style elements for the style that is
in effect. The attributes are rotated for each group values as described in “Attribute
Rotation Patterns” on page 478. In the previous example, there are three unique values
of column Stock in the Sashelp.Stocks data set: IBM, Intel, and Microsoft. The line
colors and line patterns from the GraphData1–GraphData3 style elements of the
HTMLBLUE style are used for each of the three group values. Because the
HTMLBLUE style defines the AttrPriority="COLOR" style attribute, the color-priority
attribute rotation pattern is used. The ContrastColor attribute specifies the line color, and
the LineType attribute specifies the line pattern. See Appendix 2, “Graph Style Elements
Controlling the Appearance of Grouped Data 453
Used by ODS Graphics,” on page 569 for information about the GTL style elements and
attributes. See “Attribute Rotation Patterns” on page 478 for information about how the
style attributes are rotated for group values.
The colors and patterns are assigned to the values in the order in which they occur in the
Sashelp.Stocks data set. In this case, GraphData1 is assigned to IBM, GraphData2 is
assigned to Intel, and GraphData3 is assigned to Microsoft. Other attributes such as fill
color, fill pattern, and marker color that are used in other plot types are assigned in a
similar manner. Here are some additional examples of the default grouped data
appearance for other plot types. All of the plots in these examples use the HTMLBLUE
style.
To specify different colors and patterns that you can specify a different ODS style or you
can create a custom style. For information about creating custom styles, see “Using
Custom Styles to Control the Appearance of Grouped Data” on page 455. For many
454 Chapter 23 Managing Your Graph’s Appearance

Get SAS 9.4 Graph Template Language, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.