| TEMPLATE Procedure: Plot Statements (Preproduction) |
| SCATTER Y= column | expression X= column | expression < / option(s)> ; |
| Usage Information |
Scatter Plot
![[Scatter Plot]](./images/scatterplot.gif)
| Required Arguments |
specifies the column for the X values.
specifies the column for the Y values.
| Options |
| Option | Description |
|---|---|
| BACKGROUND= color | style-reference | Specifies the background color of the graph. |
| BACKTRANSPARENCY= number | Specifies the degree of the transparency of the background. |
| DATALABEL= column | Specifies the label of the data. |
| DATALABELCOLOR= color | style-reference | Specifies the color of the data labels. |
| DATALABELFONTFAMILY= 'string' | style-reference | Specifies the font family of the data labels. |
| DATALABELFONTSIZE= dimension | style-reference | Specifies the font size of the data labels. |
| DATALABELFONTSTYLE= NORMAL | ITALIC | style-reference | Specifies the font style of the data labels. |
| DATALABELFONTWEIGHT= NORMAL | BOLD | style-reference | Specifies the weight of the font of the data labels. |
| DATALABELFORMAT= format | Specifies the format of the data labels. |
| DATATRANSPARENCY= number | specifies the degree of the transparency of the markers. |
| GROUP= column | Creates a separate scatter plot for each unique group value of the specified column. |
| INDEX =integer-column | Specifies indices for remapping the assignment of the color and the marker symbols to group values. |
| LEGENDLABEL= 'string' | Specifies the label of the legends. |
| MARKERCOLOR= color | style-reference | GRADIENT | Specifies colors for the observation markers. |
| MARKERCOLORGROUP =numeric-column | | GRADIENT | Specifies colors for the observation markers. |
| MARKERS= boolean | Specifies whether observation markers are displayed. |
| MARKERSIZE= dimension | style-reference | Specifies the marker width. The marker width is equal to the marker height. |
| MARKERSYMBOL= marker | CHARACTER | style-reference | Specifies a marker symbol of the observation markers. |
| MARKERSYMBOLGROUP=column | Assigns a name to a plot statement so that it can be referenced in other template statements. |
| NAME= 'string' | Assigns a name to a plot statement for reference in other template statements. |
| TIP= (column-list) | Specifies the information to display when the cursor is positioned over a graph element. |
| TRANSPARENCY= number | Specifies the degree of the transparency of the background and markers, when they are present in a graph. |
| XAXIS= X | X2 | Specifies whether data is mapped to the primary X axis or to the secondary X (X2) axis. |
| XERRORLOWER= numeric-column | Specifies values for the lower endpoints on the X error bars. |
| XERRORUPPER= numeric-column | Specifies values for the upper endpoints on the X error bars. |
| XMAX= number | Specifies the maximum X data value to use in the display of the data. |
| XMIN =number | Specifies the minimum X data value to use in the display of the data. |
| YAXIS= Y | Y2 | Specifies whether data is mapped to the primary Y axis or to the secondary Y (Y2) axis. |
| YERRORLOWER= numeric-column | Specifies values for the lower endpoints on the Y error bars. |
| YERRORUPPER= numeric-column | Specifies values for the upper endpoints on the Y error bars. |
| YMAX=number | Specifies the maximum Y data value to use in the display of the data. |
| YMIN=number | Specifies the minimum Y data value to use in the display of the data. |
specifies the background color of the graph.
| Default: | Specified by the GraphBackground:Background style reference. |
| Interaction: | Ignored in a LAYOUT OVERLAY block. For information, see Ignored Plot Options in a LAYOUT OVERLAY Block. |
specifies the degree of the transparency of the background color.
| Default: | 0 |
| Range: | 0 (opaque) to 1 (entirely transparent) |
| Interaction: | The BACKTRANSPARENCY= option overrides the TRANSPARENCY= option for the background. |
| Interaction: | Ignored in a LAYOUT OVERLAY block. For information, see Ignored Plot Options in a LAYOUT OVERLAY Block. |
| See also: | TRANSPARENCY= option |
specifies the label of the data.
| Default: | No labels are displayed. |
| Tip: | The position of the labels are adjusted to prevent the labels from overlapping. |
specifies the color of the data labels.
| Default: | Specified by the GraphDataDefault:ContrastColor style reference. |
| Interaction: | The DATALABELCOLOR= option overrides the GROUP= option. |
| Tip: | When the GROUP= option is used, each distinct group value is represented by a different color. The data label that is associated with the group is assigned the group color. The DATALABELCOLOR= option can be used to specify a single color for all of the data labels in a graph, without affecting items that have the group color, such as lines and marker symbols. |
specifies the font family of the data labels.
| Default: | Specified by the GraphDataText:Font_Face style reference. |
| Restriction: | You must specify one font family name. You cannot specify a list of font family names. |
specifies the font size of the data labels.
| Default: | Specified by the GraphDataText:Font_Size style reference. |
specifies the font style of the data labels.
| Default: | Specified by the GraphDataText:Font_Style style reference. |
specifies the weight of the font of the data labels.
| Default: | Specified by the GraphDataText:Font_Weight style reference. |
specifies the format of the data labels.
| Default: | The format of the data label uses the format of the column. For an unformatted numeric column, the data label uses the BEST12 format. |
| Restriction: | The w.d format must be specified using the Fw.d format. |
specifies the degree of the transparency of the markers.
| Default: | 0 |
| Range: | 0 (opaque) to 1 (entirely transparent) |
| Interaction: | The DATATRANSPARENCY= option overrides the TRANSPARENCY= option for the markers. |
| See also: | TRANSPARENCY= option |
creates a separate scatter plot for each unique group value of the specified column.
| Default: | Each distinct group value is represented in the graph by a different combination of color and marker symbol. |
| Tip: | If error bars are displayed, then the bars are assigned the color and the line pattern of its group. |
| Tip: | The representations that are used to identify the groups can be overridden individually. For example, each distinct group value is represented by a different marker symbol, but the MARKERSYMBOL= option could be used to assign the same symbol to all the plot's marker symbols. |
specifies indices for remapping the assignment of the color and the marker symbols to group values.
| Restriction: | The INDEX= option must be used with the GROUP= option. If the GROUP= option is not specified, then the INDEX= option is ignored. |
| Interaction: | If the INDEX= option is not used, then GROUP values are mapped in the order of the data. The INDEX= option must be used with the GROUP= option. If the GROUP= option is not specified, the INDEX= option is ignored. |
| Main Discussion: | Remapping the Color and Marker Symbols by Using the INDEX= option |
specifies the label of the legends.
| Default: | No label |
| Interaction: | If the GROUP= option is specified, then the group values override the LEGENDLABEL= option values. |
specifies colors for the observation markers.
| Default: | Specified by the GraphDataDefault:ContrastColor style reference. |
| Restriction: | If the GRADIENT value is specified, then the MARKERCOLORGROUP= option must also be used. Colors are specified by the ThreeColorAltRamp style element. |
| Interaction: | The MARKERCOLOR= option overrides the GROUP= option and the marker symbol is used to distinguish the groups. |
specifies the column that is used to map marker colors.
| Restriction: | The MARKERCOLORGROUP= option is ignored unless MARKERCOLOR=GRADIENT. |
| Tip: | The MARKERCOLORGROUP= option can be used to add a second response variable to an analysis. For example, in an analysis of weight by height, an age column might be specified by the MARKERCOLORGROUP= option so that the change in the gradient color of the markers reflects the change in age of the subjects in the study. |
specifies whether observation markers are displayed.
| Default: | TRUE |
specifies the marker width. The marker width is equal to the marker height.
| Default: | 10px |
specifies the marker symbol of the observation markers.
| Default: |
If the GROUP= option is not specified,
then the marker symbols are specified by the GraphDataDefault:MarkerSymbol
style reference.
If the GROUP= option is specified, then the marker symbols are specified by the MarkerSymbol attribute in the GraphData1 - GraphData12 style elements. If the GraphData1 - GraphData12 style elements do not define the MarkerSymbol attribute, then a STANDARD marker set is used. |
| Requirement: | If the CHARACTER value is specified, then the MARKERSYMBOLGROUP= option must be used. |
| Interaction: | If CHARACTER is specified for the MARKERSYMBOL= option , then the marker symbol is composed of all the characters from the values specified by the MARKERSYMBOLGROUP= option. |
| Interaction: | The MARKERSYMBOL= option overrides GROUP= option and the marker color is used to distinguish the groups. |
| Tip: | The data values are centered around the marker positions in both the X and Y directions. The positions are not adjusted to prevent overlap. |
| Main discussion: |
Specifying MARKERSYMBOL=CHARACTER
with the GROUP= option enables the values of a group column to be used as
plot markers in a plot. If the group values do not provide suitable characters,
then the MARKERSYMBOLGROUP= option can be used to specify alternative characters.
For example, the scatterplot below displays weight by height. If a column named GENDER with the values Male and Female is used as the group column, then specifying MARKERSYMBOL=CHARACTER would result in the following graph.
You can remove the overlapping points on the plot by creating a second data column that has the values M and F corresponding to the GENDER values Male and Female. When you specify the second data column in the MARKERSYMBOLGROUP= option, the following plot is displayed.
The GROUP= and the MARKERSYMBOLGROUP= options specify different colored marker symbols for each group. If the GROUP= option is not specified, then all of the markers would be the same color. |
specifies the column that is used to map the marker symbols.
| Interaction: | The MARKERSYMBOLGROUP= option is ignored unless the MARKERSYMBOL=CHARACTER. |
| Tip: | The MARKERSYMBOLGROUP= option is useful for specifying data values as the marker symbols in a graph. |
| See: | MARKERSYMBOL |
assigns a name to a plot statement for reference in other template statements.
| Restriction: | The string specified by the NAME= option must be unique within the template. |
| Restriction: | The string specified by the NAME= option cannot contain embedded spaces. |
| Tip: | The NAME= option is used mostly in the DISCRETELEGEND statement in order to coordinate the use of colors, marker symbols, and line patterns between the graph and the legend. |
| Tip: | string is case sensitive. |
specifies the information to display when the cursor is positioned over a graph element.
| Default: | All of the variables specified for the graph. |
| Requirement: | You can activate tool tips in a SAS program by specifying an ODS GRAPHICS statement that has IMAGEFMT=STATICMAP specified. |
| Requirement: | Tool tips are only available for graphs that are written to the ODS HTML destination. Tool tips are only displayed if they are activated by the SAS program that generates the ODS graphics output. |
specifies the degree of the transparency of the background and markers, if displayed in a graph.
| Default: | 0 |
| Range: | 0 (opaque) to 1 (entirely transparent) |
| Interaction: | You can specify the transparency of individual graph elements by using the BACKTRANSPARENCY= and DATATRANSPARENCY= options. The value specified by the TRANSPARENCY= option is only applied to the transparencies that you do not specify individually. |
| Interaction: | In a LAYOUT OVERLAY block, the TRANSPARENCY= option only affects the outlier markers and their labels, while the LAYOUT OVERLAY statement specifies the transparency of the background. |
specifies whether data is mapped to the primary X axis or to the secondary X (X2) axis.
| Default: | X |
| Interaction: |
Outside of a LAYOUT OVERLAY block,
an individual plot can have only one X axis. The XAXIS= option of a plot specifies
whether the axis is in the primary (bottom) or secondary (top) position. The
XAXISOPTS= option of a plot specifies whether the axis is displayed and specifies
the axis characteristics.
Within a LAYOUT OVERLAY block, multiple plots can share a primary axis and a secondary axis. The primary and secondary axes can have different scales, and the XAXIS= option for a particular plot can map data to either axis. The XAXISOPTS= and X2AXISOPTS= options of a LAYOUT OVERLAY statement specify whether the axes are displayed, and specify the axis characteristics. |
specifies values for the lower endpoints on the X error bars.
| Default: | The lower segment of the error bars is not drawn. |
| Restriction: | The error bar color cannot be changed. |
| Tip: | The values are actual values, not relative values. |
specifies values for the upper endpoints on the X error bars.
| Default: | The upper segment of the error bars is not drawn. |
| Restriction: | The error bar color cannot be changed. |
| Tip: | The values are actual values, not relative values. |
specifies the maximum X data value to use in the display of the data.
| Default: | The maximum X value in the data. |
| Restriction: | If the data contains values greater than the number that is specified for the XMAX= option, then the values are excluded from the graph, plot, or line. |
specifies the minimum X data value to use in the display of data.
| Default: | The minimum X value in the data. |
| Restriction: | If the data contains values that are less than the number specified for the XMIN= option, then the values are excluded from the graph, plot, or line. |
specifies whether data is mapped to the primary Y axis or to the secondary Y (Y2) axis.
| Default: | Y |
| Interaction: |
Outside of a LAYOUT OVERLAY block,
an individual plot can have only one Y axis. The YAXIS= option of a plot
specifies whether the axis is in the primary (left) or secondary (right) position.
The YAXISOPTS= option of a plot specifies whether the axis is displayed and
specifies the axis characteristics.
Within a LAYOUT OVERLAY block, multiple plots can share a primary axis and a secondary axis. The primary and secondary axes can have different scales, and the YAXIS= option for a particular plot can map data to either axis. The YAXISOPTS= and Y2AXISOPTS= options of a LAYOUT OVERLAY statement specify whether the axes are displayed, and specify the axis characteristics. |
specifies values for the lower endpoints on the Y error bars.
| Default: | The lower segment of the error bars is not drawn. |
| Restriction: | The error bar color cannot be changed. |
| Tip: | The values are actual values, not relative values. |
specifies values for the upper endpoints on the Y error bars.
| Default: | The upper segment of the error bars is not drawn. |
| Restriction: | The error bar color cannot be changed. |
| Tip: | The values are actual values, not relative values. |
specifies the maximum Y data value to use in the display of the data.
| Default: | The maximum Y value in the data. |
| Tip: | If the data contains values that are greater than the number specified for the YMAX= option, then the values are excluded from the graph, plot, or line. |
specifies the minimum Y data value to use in the display of the data.
| Default: | The minimum Y value in the data. |
| Tip: | If the data contains values that are less than the number specified for the YMIN= option, then the values are excluded from the graph, plot, or line. |