What's New in the SAS 9.3 Graph Template Language

Overview

New and enhanced statements for Graph Template Language (GTL) extend the versatility of the language and introduce a number of new plot types. The changes include the following:
  • new layout statements
  • new plot statements
  • new legend statements
  • new features for general use
  • enhancements to SAS 9.2 statements

New Layout Statements

The following layout statements are new:
  • LAYOUT REGION provides a container for plots that do not use axes (for example, a pie chart).
  • LAYOUT GLOBALLEGEND creates a compound legend containing multiple discrete legends.

New Plot Statements

The following plot statements are new:
  • BUBBLEPLOT creates a bubble plot of the input data, using X and Y columns to locate bubble centers and a SIZE column to control the bubble radius.
  • DENDROGRAM creates a tree diagram that is typically used to display the results of a hierarchical clustering analysis.
  • HEATMAPPARM creates a two-dimensional plot that represents the values of pre-binned, three-dimensional data.
  • HIGHLOWPLOT creates floating vertical or horizontal lines or bars that connect the minimum and maximum response values for each value of a categorical variable. The vertical version is typically used in the financial industry to plot stock values over time. The horizontal version is typically used in the Health and Life Sciences industry to display over time the duration of adverse events or of adverse reactions to medication.
  • PIECHART creates a pie chart that is computed from input data.
  • WATERFALLCHART creates a waterfall chart that is computed from input data. A waterfall chart is typically used to show credit and debit transactions or successive changes to a given state.
In the second maintenance release of SAS 9.3, the MOSAICPLOTPARM statement is new. It creates a mosaic plot from pre-summarized categorical data.

New Legend Statements

The following legend statements are new:
  • LEGENDITEM creates the definition for a legend item that can be included in a legend. The item is independent of the data and enables you to customize the legend to enhance or replace a standard legend.
  • MERGEDLEGEND consolidates legend entries when a graph displays grouped data for two plots.
  • For discrete axes that might appear crowded with too many tick values, the new AXISLEGEND statement can clean up the clutter. AXISLEGEND generates consecutive integers for display as axis-tick values in the graph. It also creates a legend that correlates those integers with the actual tick values that they represent.

New Features for General Use

Attribute Maps

The GTL now provides discrete and range “attribute maps” that enable you to map visual attributes to input data values.
  • Discrete attribute maps enable you to map discrete data to specific visual attributes (for example, color). This feature could be used to represent in the legend a data value with a specific visual attribute, regardless of the order of the values in the data or whether the value exists in the data. For example, when using gender as a grouping category for plots, you could set an attribute map for marker symbols. You could define the map so that all plots that are generated by a template use red circles to represent the values for females and blue diamonds to represent the values for males. Relevant statements: DISCRETEATTRMAP and DISCRETEATTRVAR.
  • Range attribute maps enable you to control color assignment, regardless of the current data range for a plot. This feature could be used to make the color assignments independent of the actual data range for consistency. For example, for temperature data, you could set blue for 0 and red for 100, even if the values 0 and 100 are not in the data. Relevant statements: RANGEATTRMAP and RANGEATTRVAR.

Draw Statements

A set of new draw statements enables you to draw lines, arrows, ovals, rectangles, and other shapes in your graph. You can also draw text and images. A global drawing space and drawing units for all of the draw statements is set in the BEGINGRAPH statement’s new DRAWSPACE= option. The individual draw statements provide options that enable you to set the drawing space and drawing units for that individual statement. The following draw statements are available:
  • BEGINPOLYGON
  • BEGINPOLYLINE
  • DRAWARROW
  • DRAWIMAGE
  • DRAWLINE
  • DRAWOVAL
  • DRAWRECTANGLE
  • DRAWTEXT
In the second maintenance release of SAS 9.3:
  • DRAWRECTANGLE:
    • CORNERRADIUS= specifies the radius of the rectangle corners.

General Enhancements Supported by Many of the Plots

The following new features that are supported by many of the plot statements are worth highlighting. The individual plot statements that support these features are identified in Plot Enhancements.
  • For plots that support a grouping variable:
    • A grouping variable can now display groups in clusters. To do so, use GROUP= (new for some of the plots) to specify the grouping variable and set the new GROUPDISPLAY= option to CLUSTER. The new INCLUDEMISSINGGROUP= option specifies whether missing values of the group variable are included in the plot. GROUPORDER= (new for some of the plots) specifies the order of the grouped plot elements (for example, bars) for each category value. The new CLUSTERWIDTH= option specifies the width of the group clusters as a fraction of the midpoint spacing on a discrete axis or a fraction of the minimum interval between adjacent data values on an interval axis.
    • In the first maintenance release of SAS 9.3:
      • New fill colors are generated automatically when the number of group values exceeds the number of GraphData1–GraphDataN style elements. The new fill colors are generated by repeating the GraphData1–GraphDataN colors and varying the shade of each original color on each cycle. The shade variations alternate between one shade lighter and one shade darker on each cycle.
      • The group value style attributes are now independent of group order and are always assigned in data order.
      • The attributes of the missing group value are now determined by the GraphMissing style element except when the MISSING= system option is used to specify a missing character other than the default, or a user-defined format is applied to the missing group value. In those cases, the attributes of the missing group value are determined by a GraphData1–GraphDataN style element instead of the GraphMissing style element.
  • Data skins, which can be applied with the new DATASKIN= option, enhance the visual appearance of a graph. For example, a data skin can be used to apply a glossy, three-dimensional appearance to the filled bars of a bar chart or the filled slices of a pie chart. Data skins are available only for bars, pie slices, bubbles, and scatter plot markers.
  • Transparency for the filled elements of some graph types can now be managed independently of the other transparent elements in the graph. For example, one transparency level can be set for the filled bars of a bar chart and a different transparency level can be set for the bar outlines. As in SAS 9.2, DATATRANSPARENCY= sets the transparency level for fills and lines. A different transparency level can now be set for area fills, using the new fill option TRANSPARENCY=. The new fill option is available in any option that sets area fills (for example, a FILLATTRS= option).

General Enhancements to the Output Delivery System

The following enhancements have been made to the Output Delivery System (ODS):
  • When running SAS in windowing mode for the Windows and UNIX operating environments, the default output destination has changed from LISTING to HTML.
  • When running SAS in windowing mode for the Windows and UNIX operating environments and directing output to the HTML destination, the default style has changed from DEFAULT to HTMLBLUE. The new all-color HTMLBLUE style is ideal for ODS graphics because it provides superior color coordination between graphs and tables, using colors to differentiate between groups.
  • The LISTING, HTML, and PRINTER destinations now support Scalable Vector Graphics (SVG).
For more information about these and other ODS enhancements, consult SAS Language Reference: Concepts and SAS Output Delivery System: User's Guide.

Enhancements to SAS 9.2 Statements

Layout Enhancements

LAYOUT DATALATTICE and LAYOUT DATAPANEL:
  • These lattice-type layouts now support independent X2 (top) and Y2 (right) axes. In SAS 9.2, the X2 axis could mirror only the X axis, and the Y2 axis could mirror only the Y axis.
  • INCLUDEMISSINGCLASS= specifies whether to include grid cells for crossings of the class variables that contain a missing value.
  • INSETOPTS= now provides TITLE= for setting an inset title and TITLEATTRS= for setting the text attributes of that title.
  • SHRINKFONTS= specifies whether fonts in the multi-cell layout are scaled when appropriate, depending on the nesting levels of the layouts that have SHRINKFONTS=TRUE.
  • SPACEFILL= (in the SIDEBAR statement) specifies whether the sidebar’s contents should expand to fill the entire sidebar area, up to its boundaries.
LAYOUT LATTICE:
  • The LATTICE layout now supports independent X2 (top) and Y2 (right) axes. In SAS 9.2, the X2 axis could mirror only the X axis, and the Y2 axis could mirror only the Y axis.
  • SHRINKFONTS= specifies whether fonts in a multi-cell layout are scaled when appropriate, depending on the nesting levels of the layouts that have SHRINKFONTS=TRUE.
  • SPACEFILL= (in the SIDEBAR statement) specifies whether the sidebar’s contents should expand to fill the entire sidebar area, up to its boundaries.
LAYOUT GRIDDED:
  • SHRINKFONTS= specifies whether fonts in a multi-cell layout are scaled when appropriate, depending on the nesting levels of the layouts that have SHRINKFONTS=TRUE.
LAYOUT OVERLAY:
  • The INNERMARGIN statement generates one or more “inner margins” within a LAYOUT OVERLAY container. An inner margin is a nested region at the top or bottom of the OVERLAY container.
  • ASPECTRATIO= specifies the aspect ratio of the rectangle that forms the bounds of the plot wall.
LAYOUT PROTOTYPE:
  • ASPECTRATIO= specifies the aspect ratio of the plot wall area.

Plot Enhancements

BANDPLOT:
  • INCLUDEMISSINGGROUP= specifies whether missing values of the group variable are included in the plot.
  • Transparency can be managed separately for the filled bands and the band outline. As in SAS 9.2, DATATRANSPARENCY= sets the transparency level for both the fills and the lines. The new FILLATTRS=(TRANSPARENCY=number) can set a different transparency level for just the band fill.
BARCHART and BARCHARTPARM:
  • Both statements support the general plot enhancements that were listed previously. For more information, see General Enhancements Supported by Many of the Plots.
  • FILLPATTERNATTRS= specifies the attributes for fill patterns, which are useful for displaying monochrome graphs (typically the black and white graphs that are printed in journal articles).
  • BASELINEINTERCEPT= specifies the response axis intercept for the baseline.
  • TARGET= specifies a numeric column that provides target values to display on the chart bars as a small triangle with a line extending from it across the bar.
BLOCKPLOT:
  • BLOCKPLOT supports the general plot enhancements (excluding data skins) that were listed previously. For more information, see General Enhancements Supported by Many of the Plots.
  • EXTENDBLOCKONMISSING= specifies whether a missing value in the BLOCK column starts a new block or reverts to the previous nonmissing value.
  • INCLUDEMISSINGCLASS= specifies whether missing values of the class variable are included in the plot.
BOXPLOT and BOXPLOTPARM:
  • Both statements now support the GROUP= option and clustered groups. For more information, see General Enhancements Supported by Many of the Plots. For overriding default grouping, the new INDEX= option can specify indices for mapping line and fill attributes (color and pattern) to one of the GraphData1–GraphDataN style elements.
  • Box plots now support an independent, numeric axis. By default, box plot requests a discrete category axis. If your data corresponding to the independent axis is numeric (or time), you can set TYPE= to LINEAR, TIME, or LOG in the layout’s axis options. With a numeric axis in effect, you can also use the new INTERVALBOXWIDTH= option to specify the box width.
  • Box plots now support tooltips. The TIP= and OUTLIERTIP= options can be used to set the tips for the boxes and the outliers. The TIPFORMAT = and TIPLABEL= options can be used to format and label the tips. BOXPLOTPARM also supports the ROLENAME= option (not available for BOXPLOT), which specifies user-defined roles that can be used to display additional information in the tooltips.
  • BOXPLOTPARM supports the DISPLAYSTATS= options (not available for BOXPLOT and horizontal BOXPLOTPARM), which specifies the statistics to be displayed for each box.
  • In the second maintenance release for SAS 9.3, BOXPLOT supports the DISPLAYSTATS= option (not available for horizontal BOXPLOT), which specifies the statistics to be displayed for each box.
BUBBLEPLOT:
  • In the second maintenance release for SAS 9.3:
    • RELATIVESCALETYPE= specifies the type of scaling that is to be applied to the SIZE= column values.
    • SIZETHRESHOLDMAX= specifies a SIZE= column value threshold at which bubble size is clamped to the BUBBLERADIUSMAX= option value.
ELLIPSE and ELLIPSEPARM:
  • Transparency can be managed separately for the filled ellipse and the ellipse outline. DATATRANSPARENCY= sets the transparency level for both the fill and the line. FILLATTRS=(TRANSPARENCY=number) can set a different transparency level for just the fill.
  • INCLUDEMISSINGGROUP= specifies whether missing values of the group variable are included in the plot. (This option is available for ELLIPSEPARM but not for ELLIPSE.)
FRINGEPLOT, LINEPARM, LOESSPLOT, PBSPLINEPLOT, and REGRESSIONPLOT:
  • Each of these statements has a new INCLUDEMISSINGGROUP= options, which specifies whether missing values of the group variable are included in the plot.
HIGHLOWPLOT:
  • In the second maintenance release for SAS 9.3:
    • ENDCAPDISPLAYPOLICY= specifies whether to display outlined colored regions or just colored regions.
HISTOGRAMPARM:
  • In the second maintenance release for SAS 9.3:
    • DATALABEL= specifies a column for the bar labels.
    • DATALABELATTRS= specifies the color and font attributes of the bar labels.
NEEDLEPLOT:
  • NEEDLEPLOT supports clustered groups. For more information, see General Enhancements Supported by Many of the Plots. It does not support the data skins or dual transparency levels.
  • DATALABEPOSITION= specifies the location of the data labels relative to the needle lines and markers.
  • DISCRETEOFFSET= specifies an amount to offset all needle lines and markers from discrete X values when graphing multiple response variables side by side on a common axis.
PIECHART:
  • In the first maintenance release for SAS 9.3:
    • The STAT= option value PERCENT is changed to PCT in order to make it consistent with other plots.
    • The DATALABELCONTENT= option default is changed in order to reduce the information that is displayed by default and to customize the information for the STAT= option value. The new default depends on the STAT= option value as follows:
      • For STAT=PCT, the DATALABELCONTENT= default is (CATEGORY PERCENT).
      • For all other values of the STAT= option, the DATALABELCONTENT= default is STANDARD.
SCATTERPLOT:
  • SCATTERPLOT supports clustered groups and data skins. For more information, see General Enhancements Supported by Many of the Plots.
  • DATALABEPOSITION= specifies the location of the data labels relative to the markers.
  • USEDISCRETESIZE= specifies that the marker size should be based on fraction of the midpoint spacing. DISCRETEMARKERSIZE= specifies the fractional size to use for that marker size.
  • MARKERSIZERESPONSE= specifies a column to use for varying marker sizes with response values. MARKERSIZEMAX= and MARKERSIZEMIN= enable you to manage the range of the marker-size variation when MARKERSIZERESPONSE= is used.
SCATTERPLOTMATRIX:
  • DATALABEPOSITION= specifies the location of the data labels relative to the markers.
  • INCLUDEMISSINGGROUP= specifies whether missing values of the group variable are included in the plot.
  • INSETOPTS= now provides TITLE= for setting an inset title and TITLEATTRS= for setting the text attributes of that title.
SERIESPLOT:
  • SERIESPLOT supports clustered groups. For more information, see General Enhancements Supported by Many of the Plots.
  • DATALABEPOSITION= specifies the location of the data labels relative to the series line and markers.
  • SMOOTHCONNECT= specifies that the plot vertices be connected by a smooth line.
STEPPLOT:
VECTORPLOT:
  • DATALABEPOSITION= specifies the location of the data labels relative to the vector lines and arrow heads.
  • INCLUDEMISSINGGROUP= specifies whether missing values of the group variable are included in the plot.

Axis Enhancements

LAYOUT OVERLAY:
  • NAME= assigns a name to an axis for reference in other statements.
  • DISCRETEOPTS= supports the following new features for discrete axes:
    • COLORBANDS= specifies the display of alternating wall-color bands corresponding to the discrete axis bins. COLORBANDSATTRS= specifies the appearance of the alternating wall-color band.
    • TICKTYPE= specifies the position of the axis tick mark.
    • TICKVALUEFITPOLICY= specifies a policy for avoiding tick value collision on an axis.
LAYOUT OVERLAYEQUATED:
  • In the second maintenance release of SAS 9.3:
    • REVERSE= specifies whether the tick values on the X or Y axis should appear in the reverse order.
LAYOUT LATTICE:
  • NAME= assigns a name to an axis for reference in an AXISLEGEND statement.
  • REVERSE= specifies whether the axis origin should be reversed.
  • DISCRETEOPTS= supports the following new features for discrete axes:
    • TICKTYPE= specifies the position of the axis tick mark.
    • TICKVALUEFITPOLICY= specifies a policy for avoiding tick value collision on an axis.

Attribute Map Enhancements

RANGEATTRMAP:
  • In the first maintenance release of SAS 9.3, for the RANGE statement:
    • RANGEALTCOLOR= specifies a single contrast color to represent the defined value range.
    • RANGEALTCOLORMODEL= specifies either a style element or a list of one or more specific contrast colors to represent the defined value range.

Deprecated Statement Options

In the first maintenance release of SAS 9.3:
  • The DRAWTEXT statement BACKGROUNDATTRS= option is deprecated.
  • The LAYOUT GLOBALLEGEND statement BACKGROUNDATTRS= option is deprecated.