SGPLOT Procedure
VLINE Statement
Creates a vertical line chart (the line is horizontal).
| Restrictions: | The VLINE statement can be combined only with other categorization plot statements in the SGPLOT procedure. See Plot Compatibility. and Plot Axes. |
|---|---|
| When category plots are overlaid, all of the plots must use the same category variable. | |
| Tip: | You can use the VLINE statement with the VBAR statement to create a bar-line chart. |
| See: | Marker Fills and Outlines |
| Examples: | About Line Charts |
| Creating a Bar-Line Chart |
Syntax
Summary of Optional Arguments
Appearance options
ATTRID=character-value
specifies the value of the ID variable in a discrete attribute map data set.
BREAK
breaks the line whenever the computed statistic for a category value is missing.
DATASKIN=NONE | CRISP | GLOSS | MATTE | PRESSED | SHEEN
specifies a special effect to be used on the plot.
DISCRETEOFFSET=numeric-value
specifies an amount to offset all lines from discrete category values.
LINEATTRS=style-element<(options)> | (options)
specifies the appearance of the lines in the line plot.
TRANSPARENCY=value
specifies the degree of transparency for the plot.
Axis options
X2AXIS
assigns the category variable to the secondary (top) horizontal axis.
Y2AXIS
assigns the response variable to the secondary (right) vertical axis.
Data tip options
TIP=(variable-list) | NONE
specifies the data tip information to be displayed when the cursor is positioned over the graphics element.
TIPFORMAT=(format-list)
applies formats to the list of data tip variables that you specify in the TIP= option.
TIPLABEL=(label-list)
applies labels to the list of data tip variables that you specify in the TIP= option.
Group options
CLUSTERWIDTH=numeric-value
specifies the width of the group clusters as a fraction of the midpoint spacing.
GROUP=variable
specifies a variable that is used to group the data.
GROUPDISPLAY=CLUSTER | OVERLAY
specifies how to display grouped lines.
GROUPORDER=DATA | REVERSEDATA | ASCENDING | DESCENDING
specifies the ordering of the groups within a category.
Label options
CURVELABEL
adds a label to the curve or curves.
CURVELABEL="text-string"
specifies a label for the curve when only one curve is drawn.
CURVELABELATTRS=style-element<(options)> | (options)
specifies the appearance of the labels in the plot when you use the CURVELABEL= option.
CURVELABELLOC=OUTSIDE | INSIDE
specifies whether the curve label is placed inside the plot axes (INSIDE) or outside of the plot axes (OUTSIDE).
CURVELABELPOS=AUTO | END | MAX | MIN | START
specifies the location of the curve label.
DATALABEL
DATALABEL=variable
displays a label for each data point.
DATALABELATTRS=style-element<(options)> | (options)
specifies the appearance of the labels in the plot when you use the DATALABEL= option.
DATALABELPOS=DATA | BOTTOM | TOP
specifies the location of the data label.
LEGENDLABEL="text-string"
specifies the label that identifies the line plot in the legend.
SPLITCHAR="character-list"
specifies one or more characters on which the text for curve labels is always split.
SPLITCHARNODROP
specifies that the split characters are included in the displayed value.
SPLITJUSTIFY=LEFT | CENTER | RIGHT
specifies the horizontal alignment of the value text that is being split.
STATLABEL | NOSTATLABEL
specifies whether the response variable statistic is displayed in the axis and legend labels.
Limit options
LIMITATTRS=style-element<(options)> | (options)
specifies the appearance of the limit lines in the plot.
LIMITCAPSCALE=positive-number
specifies a positive number to use as a multiplier for changing the default width of the limit-bar cap (serif).
LIMITS=BOTH | LOWER | UPPER
adds limit lines to the plot.
LIMITSTAT=CLM | STDDEV | STDERR
specifies the statistic for the limit lines.
NOLIMITCAPS
suppresses the serif cap on limit lines, if limit lines are displayed.
NUMSTD=n
specifies the number of standard units for the limit lines, when you specify LIMITSTAT=STDDEV or LIMITSTAT=STDERR.
Marker options
FILLEDOUTLINEDMARKERS
specifies that markers have a fill and an outline.
MARKERATTRS=style-element<(options)> | (options)
specifies the appearance of the markers in the plot.
MARKERFILLATTRS=style-element | (COLOR=color)
specifies the color of the marker fill.
MARKEROUTLINEATTRS=style-element<(options)> | (options)
specifies the appearance of the marker outlines.
MARKERS
adds markers to the plot.
Plot options
ALPHA=numeric-value
specifies the confidence level for the confidence limits.
CATEGORYORDER=RESPASC | RESPDESC
specifies the order in which the categories are arranged.
FREQ=numeric-variable
specifies a variable for the frequency count for each observation in the input data.
MISSING
accepts a missing value as a valid category value.
RESPONSE=response-variable
specifies a numeric response variable for the plot.
URL=character-variable
specifies an HTML page to be displayed when parts of the plot are selected.
WEIGHT=numeric-variable
specifies a variable that contains values to be used as weights for the calculations.
Plot reference options
NAME="text-string"
assigns a name to a plot statement.
Statistics options
STAT=FREQ | MEAN | MEDIAN | PERCENT | SUM
specifies the statistic for the vertical axis.
Required Argument
category-variable
Optional Arguments
ALPHA=numeric-value
specifies the confidence level for the confidence limits. Specify a number between 0.00 (100% confidence) and 1.00 (0% confidence).
| Default | .05 |
|---|---|
| Interactions | This option has no effect if you do not specify LIMITSTAT=CLM. |
| If your plot is overlaid with other categorization plots, then the first ALPHA= value that you specify is used for all of the plots. |
ATTRID=character-value
specifies the value of the ID variable in a discrete attribute map data set. You specify this option only if you are using an attribute map to control visual attributes of the graph.
| See | Using Discrete Attribute Maps |
|---|---|
| Overview of Attribute Maps |
BREAK
breaks the line whenever the computed statistic for a category value is missing. For example, if a response variable is used and it has all missing values for a certain category value, the SUM or MEAN for this category value is missing. By default in such cases, the response value for the previous category is joined to the response value for the next category value by a line segment. If BREAK is specified, this segment is not drawn.
| Note | The observation is excluded from the graph when there is a missing value for the FREQ variable. |
|---|
CATEGORYORDER=RESPASC | RESPDESC
specifies the order in which the categories are arranged. By default, the plot is sorted in ascending order based on the category values. You can change the order so that it is based on the response values.
Specify one of the following values:
RESPASC
RESPDESC
| Default | The plot is sorted in ascending order based on the category values. |
|---|---|
| Restrictions | This option takes effect only when the plot statement specifies a response variable and the axis for that variable is numeric. If the axis is not numeric, an error is generated and a message is written to the SAS log. |
| Uniform scaling and response sorting cannot occur on the same axis. If the UNIFORM= option is used in the SGPLOT statement, the UNIFORM option is ignored for the sorted response axis and a note is generated in the log. The UNIFORM= option is applied to the other axes and groups if requested. Note that the UNIFORM= option can selectively apply scaling to only the X or Y axis | |
| Interactions | When a group variable is used with the CATEGORYORDER= option, the category order is not affected by the value of the groups. The categories are always sorted by the response statistic at a category level. |
| When this option and the GROUPORDER= option are both specified, the GROUPORDER= option is ignored. | |
| Notes | If CATEGORYORDER= is specified in multiple statements, the procedure sorts by the last statement in which it is specified. |
| When two or more observations have the same response values, there is no guarantee that the tied values will be sub-sorted. |
CLUSTERWIDTH=numeric-value
specifies the width of the group clusters as a fraction of the midpoint spacing. Specify a value from 0.0 (narrowest) to 1.0 (widest).
| Default | 0.8 |
|---|---|
| Interaction | This option is applicable only when the GROUP option is specified, when GROUPDISPLAY=CLUSTER, and when the category axis is discrete. |
CURVELABEL
adds a label to the curve or curves. For ungrouped data, the Y variable label is used as the curve label. For grouped data, the group values are used as curve labels.
| Interactions | If the plot uses a broken linear or time axis, the curve label might not align properly with the curve in some cases. |
|---|---|
| If you specify VALUES=, MAX=, or MIN= in an axis statement, the points used to determine the position of the curve label might fall outside the graph area. In this case, the curve label might not be displayed, or its position might not be correct. | |
| By default, CURVELABEL removes a plot from an automatic legend because the curve label is considered redundant information. However, you can override that behavior by specifying the NAME= option in the plot statement. Then include the plot name in a KEYLEGEND statement. If your procedure has more than one plot statement, do this for each plot that you want included in the legend. |
CURVELABEL="text-string"
specifies a label for the curve when only one curve is drawn.
| Restriction | This option is ignored when the GROUP= option is in effect. To label the curves in that case, use CURVELABEL instead. |
|---|---|
| Interactions | If the plot uses a broken linear or time axis, the curve label might not align properly with the curve in some cases. |
| If you specify VALUES=, MAX=, or MIN= in an axis statement, the points used to determine the position of the curve label might fall outside the graph area. In this case, the curve label might not be displayed, or its position might not be correct. | |
| By default, CURVELABEL= removes a plot from an automatic legend because the curve label is considered redundant information. However, you can override that behavior by specifying the NAME= option in the plot statement. Then include the plot name in a KEYLEGEND statement. If your procedure has more than one plot statement, do this for each plot that you want included in the legend. |
CURVELABELATTRS=style-element<(options)> | (options)
specifies the appearance of the labels in the plot when you use the CURVELABEL= option. You can specify the appearance by using a style element or by specifying specific options. If you specify a style element, you can also specify options to override specific appearance attributes.
For a description of the text options, see Text Attributes.
| Default | For ungrouped data, the Color, FontFamily, FontSize, FontWeight, and FontStyle attributes of the GraphValueText style element in the current style. |
|---|---|
| For grouped data, the FontFamily, FontSize, FontWeight, and FontStyle attributes of the GraphValueText style element, and the ContrastColor attribute of a GraphData1–GraphDatan style element in the current style. | |
| Interaction | This option has no effect unless the CURVELABEL option is also specified. |
| Examples |
|
Here is an example that specifies a style
element:
|
CURVELABELLOC=OUTSIDE | INSIDE
specifies whether the curve label is placed inside the plot axes (INSIDE) or outside of the plot axes (OUTSIDE).
| Default | INSIDE |
|---|
CURVELABELPOS=AUTO | END | MAX | MIN | START
specifies the location of the curve label. Specify one of the following values:
AUTO
places the curve label outside the plot area near the end of the curve along unused axes whenever possible (typically Y2 or X2).
| Interaction | This value takes effect only when CURVELABELLOC=OUTSIDE. |
|---|
END
MAX
MIN
START
| Default | END if CURVELABELLOC=INSIDE |
|---|---|
| AUTO if CURVELABELLOC=OUTSIDE | |
| Interactions | This option has no effect unless the CURVELABEL option is also specified. |
| The START and END suboptions take effect only when CURVELABELLOC=INSIDE. |
DATALABEL
DATALABEL=variable
displays a label for each data point.
- If you specify
a variable, then the values of that variable are
used for the data labels.
If the values of the label variable are not the same for each category, then the rendered label is indeterminate. In that case, either the first or last-occurring values are displayed. With data that is stored in a table, the minimum values are displayed.
- If you do not specify a variable, then the values of the calculated response are used for the data labels. If you do not specify a response variable, then the frequency counts of the category variable are displayed.
| Interactions | When DISCRETEOFFSET= and DATALABELPOS= are both specified, the DISCRETEOFFSET= option has no effect on the data labels. Only the plot is offset. If you remove DATALABELPOS= from the plot statement, the data labels are offset. |
|---|---|
| If you also specify LIMITS or LIMITSTAT, then the limit labels are also shown. Limit labels are shown when you use DATALABEL (without a variable). |
DATALABELATTRS=style-element<(options)> | (options)
specifies the appearance of the labels in the plot when you use the DATALABEL= option. You can specify the appearance by using a style element or by specifying specific options. If you specify a style element, you can also specify options to override specific appearance attributes.
For a description of the text options, see Text Attributes.
| Default | For ungrouped data, the Color, FontFamily, FontSize, FontStyle, and FontWeight attributes of the GraphDataText style element in the current style. |
|---|---|
| For grouped data, for the label font, the FontFamily, FontSize, FontStyle, and FontWeight attributes of the GraphDataText style element in the current style. For the label color, when DATALABELPOS=DATA, the ContrastColor attribute of a GraphData1–GraphDatan style element. Otherwise, the Color attribute of the GraphDataText style element. | |
| Interaction | This option has no effect unless the DATALABEL option is also specified. |
| Examples |
|
Here is an example that specifies a style element:
|
DATALABELPOS=DATA | BOTTOM | TOP
specifies the location of the data label. Specify one of the following values:
DATA
BOTTOM
TOP
| Default | DATA |
|---|---|
| Interactions | This option displays limit information when limits are specified. When limits are specified, the default data label position is BOTTOM. |
| This option displays group values for each category when GROUP= is also specified. | |
| This option displays response values for each overlaid chart. | |
| This option has no effect unless you also specify the DATALABEL option. | |
| When you specify a value of TOP or BOTTOM for this option, the splitting of data labels (using the SPLITCHAR= option) is not supported. |
DATASKIN=NONE | CRISP | GLOSS | MATTE | PRESSED | SHEEN
specifies a special effect to be used on the plot. The data skin affects all plot lines. The data skin affects all line marker symbols, if they are displayed. If the marker symbol is not filled, then the data skin is applied to the outlines. Specify one of the following:
|
NONE
|
CRISP
|
GLOSS
|
|
MATTE
|
PRESSED
|
SHEEN
|
If you specify markers with the plot, then the data skin affects the markers as well.
|
NONE
|
CRISP
|
GLOSS
|
|
MATTE
|
PRESSED
|
SHEEN
|
| Default | NONE |
|---|---|
| Restriction | The ODS GRAPHICS option DATASKINMAX= controls the maximum number of graphics elements that are skinned in a plot statement. The maximum number is 200 by default. When this limit is exceeded for a plot, the specified data skin is not applied. Use the DATASKINMAX= option to increase or decrease the maximum limit. |
| See | Using Data Skins |
DISCRETEOFFSET=numeric-value
specifies an amount to offset all lines from discrete category values. Specify a value from -0.5 (left offset) to +0.5 (right offset).
| Default | 0.0 (no offset) |
|---|---|
| Requirement | This option is applicable only when the category axis is discrete. |
FILLEDOUTLINEDMARKERS
specifies that markers have a fill and an outline.
| Requirement | The marker symbol, derived either from the applied style or specified with the MARKERATTRS= option, must have the “Filled” suffix in its name. Otherwise, this option is ignored. See marker symbols. |
|---|---|
| Interaction | This option has no effect unless MARKERS is also specified. |
| Tip | Use the MARKERFILLATTRS= and MARKEROUTLINEATTRS= options to specify attributes for the fill and outline. |
| See | For usage information and an example, see Marker Fills and Outlines. |
FREQ=numeric-variable
specifies a variable for the frequency count for each observation in the input data. Each observation is repeated n times for computational purposes, where n is the value of the numeric variable.
| Restrictions | If the value of FREQ= for a given observation is missing or is less than 1, that observation is not used in the analysis. |
|---|---|
| If the value is not an integer, only the integer portion is used. | |
| Interactions | If your plot is overlaid with other categorization plots, then the first FREQ variable that you specified is used for all of the plots. |
| When FREQ= and MISSING are both specified, the MISSING option has no effect. |
GROUP=variable
specifies a variable that is used to group the data. The plot elements for each group value are automatically distinguished by different visual attributes.
| Restriction | If you specify a group variable in a category chart, and the procedure contains more than one category chart statement, all of the charts must specify the same GROUP variable. If you do not specify the same GROUP= option for all of the category charts, then an error is generated. |
|---|---|
| Interaction | When the procedure contains both computed and non-computed plot statements, the assignment of group attributes does not always align between the plots. If you need to control the group attribute assignment for these types of plots, consider using an attribute map. For more information, see Using Attribute Maps to Control Visual Attributes. |
| Tip | ODS Graphics limits the number of groups to 1000. Use the GROUPMAX= option in the ODS GRAPHICS statement to change the maximum number of groups that can be processed. |
GROUPDISPLAY=CLUSTER | OVERLAY
specifies how to display grouped lines.
CLUSTER
OVERLAY
grouped items are drawn at the exact coordinate and might overlap. Each group is represented by unique visual attributes derived from the GraphData1–GraphDatan style elements in the current style.
| Default | OVERLAY |
|---|---|
| Interaction | This option is ignored unless GROUP= is specified. |
GROUPORDER=DATA | REVERSEDATA | ASCENDING | DESCENDING
specifies the ordering of the groups within a category.
DATA
REVERSEDATA
ASCENDING
DESCENDING
| Default | ASCENDING |
|---|---|
| Interactions | The DATA and REVERSEDATA values have no effect when you are using data that is stored in a table. |
| This option is ignored unless GROUP= is specified. | |
| By default, the groups in the legend are shown in the order that is specified in GROUPORDER=. The order in the legend can be changed using the SORTORDER= option in the KEYLEGEND statement. | |
| The default group order can vary for different types of plots. If your graph contains plot overlays, the default group order for the first plot statement is applied to all the other overlaid plots that use default values. If you specify the group order for a plot, then your specified value is honored. | |
| Note | The ASCENDING and DESCENDING settings linguistically sort the group values within each category for display position purposes only. For numeric data, the order is based on the unformatted values. For character data, the order is based on the formatted values. The data order of the observations and the visual attributes that are assigned to the group values remain unchanged. |
| Tip | The category order can be changed using the DISCRETEORDER= option in the axis statement for the category axis. |
LEGENDLABEL="text-string"
specifies the label that identifies the line plot in the legend. By default, the label of the response variable is used. If there is no response variable label, then the name of the response variable and the computed statistic (SUM or MEAN) are used. If you do not specify a response variable, then the legend label is “Frequency”.
| Interaction | The LEGENDLABEL= option has no effect if you also specify the GROUP= option in the same plot statement. |
|---|
LIMITATTRS=style-element<(options)> | (options)
specifies the appearance of the limit lines in the plot. You can specify the appearance by using a style element or by specifying specific options. If you specify a style element, you can also specify options to override specific appearance attributes.
For a description of the line options, see Line Attributes and Patterns.
| Default | For ungrouped data, the ContrastColor, LineStyle, and LineThickness attributes attributes of the GraphError style element in the current style. |
|---|---|
| For grouped data, the LineStyle and LineThickness attributes of the GraphError style element, and the ContrastColor attribute of a GraphData1–GraphDatan style element in the current style. |
LIMITCAPSCALE=positive-number
specifies a positive number to use as a multiplier for changing the default width of the limit-bar cap (serif). For example, LIMITCAPSCALE=2 doubles the default cap width and LIMITCAPSCALE=0.5 reduces the default cap width by half.
| Default | 1 |
|---|---|
| Interaction | For this option to have any effect, either LIMITS= or LIMITSTAT= must be specified. |
| Tip | The thickness (height) of the serif cap honors the line thickness specified in the LIMITATTRS= option. The cap pattern is always solid. |
LIMITS=BOTH | LOWER | UPPER
adds limit lines to the plot. Specify one of the following values:
BOTH
LOWER
UPPER
By default, no limit lines are displayed. However, if you specify the LIMITSTAT= option, then the default is BOTH.
| Interaction | Limit lines are displayed only when you specify STAT= MEAN. |
|---|---|
| Tip | To display limit labels, specify DATALABEL (without a variable). |
LIMITSTAT=CLM | STDDEV | STDERR
specifies the statistic for the limit lines. Specify one of the following statistics:
CLM
STDDEV
STDERR
| Default | If you specify the LIMITS= option, then the default for LIMITSTAT= is CLM. Otherwise, there is no default. |
|---|---|
| Interaction | If you specify the LIMITSTAT= option, then the default value for the LIMITS= option is BOTH. |
| Tip | To display limit labels, specify DATALABEL (without a variable). |
LINEATTRS=style-element<(options)> | (options)
specifies the appearance of the lines in the line plot. You can specify the appearance by using a style element or by specifying specific options. If you specify a style element, you can also specify options to override specific appearance attributes.
For a description of the line options, see Line Attributes and Patterns.
| Default | For ungrouped data, the GraphDataDefault style element in the current style. For grouped data, a GraphData1–GraphDatan style element in the current style. The effective attributes are: ContrastColor, LineStyle, and LineThickness. |
|---|
MARKERATTRS=style-element<(options)> | (options)
specifies the appearance of the markers in the plot. You can specify the appearance by using a style element or by specifying specific options. If you specify a style element, you can also specify options to override specific appearance attributes.
For a description of marker attributes, see Marker Attributes and Symbols.
| Default | For ungrouped data, the GraphDataDefault style element in the current style. For grouped data, a GraphData1–GraphDatan style element in the current style. The effective attributes are ContrastColor and MarkerSymbol. |
|---|---|
| Interactions | This option has no effect unless you also specify the MARKERS option. |
| Suboption COLOR= is ignored when option FILLEDOUTLINEDMARKERS is also specified. In that case, use option MARKERFILLATTRS= to specify the marker color. | |
| Suboption COLOR= in option LINEATTRS= overrides the default marker color. |
MARKERFILLATTRS=style-element | (COLOR=color)
specifies the color of the marker fill. You can specify colors using a number of different color-naming schemes. For more information, see Color-Naming Schemes.
| Default | For ungrouped data, the Color attribute of the GraphDataDefault style element in the current style. For grouped data, the Color attribute of a GraphData1–GraphDatan style element in the current style. |
|---|---|
| Requirement | Option FILLEDOUTLINEDMARKERS must be specified for MARKERFILLATTRS= to have any effect. |
| Interaction | This option overrides any color that is specified with the MARKERATTRS= option. |
| Tip | You can also use the MARKEROUTLINEATTRS= option to specify attributes for the marker outline. |
| See | For usage information and an example, see Marker Fills and Outlines. |
MARKEROUTLINEATTRS=style-element<(options)> | (options)
specifies the appearance of the marker outlines. You can specify the appearance by using a style element or by specifying specific options. If you specify a style element, you can also specify options to override specific appearance attributes.
For the options, you can specify either or both of the following:
- line color
- line thickness
For a description of the line options, see Line Attributes and Patterns.
| Default | For ungrouped data, the GraphOutlines style element in the current style. For grouped data, a GraphData1–GraphDatan style element in the current style. The effective attributes are ContrastColor and LineThickness |
|---|---|
| Requirement | Option FILLEDOUTLINEDMARKERS must be specified for MARKEROUTLINEATTRS= to have any effect. |
| Tip | You can also use the MARKERFILLATTRS= option to specify attributes for the fill. |
| See | For usage information and an example, see Marker Fills and Outlines. |
MARKERS
adds markers to the plot.
MISSING
accepts a missing value as a valid category value. By default, observations with missing values are ignored. If more than one chart is specified in the procedure, the MISSING option affects the calculations for all of the charts.
| Interaction | This option has no effect when FREQ= is specified. |
|---|
NAME="text-string"
assigns a name to a plot statement. You can use the name to refer to this plot in other statements.
| Note | The text-string is case-sensitive and must define a unique name within the procedure. |
|---|---|
| Tip | This option is often used with legend statements in order to coordinate the use of colors and line patterns between the graph and the legend. |
NOLIMITCAPS
suppresses the serif cap on limit lines, if limit lines are displayed.
| Interaction | The appearance of the limit lines is controlled by the LIMITATTRS= option. |
|---|
NUMSTD=n
specifies the number of standard units for the limit lines, when you specify LIMITSTAT=STDDEV or LIMITSTAT=STDERR. You can specify any positive number, including decimals.
| Default | 1 |
|---|
RESPONSE=response-variable
specifies a numeric response variable for the plot. The summarized values of the response variable are displayed on the vertical axis.
SPLITCHAR="character-list"
specifies one or more characters on which the text for curve labels is always split. The text is split at every occurrence of the specified split character or characters.
"character-list" is one or more characters with no delimiter between each character and enclosed in quotation marks. For example, to specify the split characters a, b, and c, use the following option:
SPLITCHAR="abc"
When multiple split characters are specified, each character in the list is treated as a separate split character unless the specified characters appear consecutively in the value. In that case, all of the specified split characters together are treated as a single split character.
If the value does not contain any of the specified split characters, a split does not occur.
| Default | Values are not split. |
|---|---|
| Interactions | This option has no effect unless either CURVELABEL or DATALABEL is specified. |
| When the text is split, the split characters are not included in the displayed value by default. If you want the split characters to appear in the values, then also specify SPLITCHARNODROP. | |
| You can specify the justification of the text by using the SPLITJUSTIFY= option. | |
| Notes | When multiple characters are specified, the order of the characters in the list is not significant. |
| The split characters are case sensitive. | |
| Tip | If you specify data labels and curve labels, this option affects both types of labels. If you do not want to split both types with the same split character, consider using an overlaid plot in your graph. You can then split data labels in one plot and curve labels in the other. |
| See | Fit Policies for Axis Tick Values, Curve Labels, and Data Labels |
SPLITCHARNODROP
specifies that the split characters are included in the displayed value.
| Interaction | This option has no effect unless SPLITCHAR= is also specified. |
|---|---|
| See | Fit Policies for Axis Tick Values, Curve Labels, and Data Labels |
SPLITJUSTIFY=LEFT | CENTER | RIGHT
specifies the horizontal alignment of the value text that is being split.
| Interaction | This option has no effect unless you specify the SPLITCHAR= option. |
|---|---|
| See | Fit Policies for Axis Tick Values, Curve Labels, and Data Labels |
STAT=FREQ | MEAN | MEDIAN | PERCENT | SUM
specifies the statistic for the vertical axis. Specify one of the following:
FREQ
the frequencies of the response or category variable. The frequencies are calculated as follows:
- If you specify the RESPONSE= option, FREQ calculates the frequency of the response variable.
- If you do not specify the RESPONSE= option, FREQ calculates the frequency of the category variable.
MEAN
the mean of the response variable.
| Interaction | For STAT=MEAN to take effect, you must also specify the RESPONSE= option. |
|---|
MEDIAN
the median of the response variable.
| Interaction | For STAT=MEDIAN to take effect, you must also specify the RESPONSE= option. |
|---|
PERCENT
the percentage of the response or category variable. The percentage is calculated as follows:
- If you specify the RESPONSE= option, PERCENT calculates the percentage of the sum of the response variable.
- If you do not specify the RESPONSE= option, PERCENT calculates the percentage of the frequency of the category variable.
When calculating the percentage of the sum, it is possible to have negative percentage values. However, the procedure calculates the absolute value of these percentages. Therefore, the percentages add up to 100% at the requested level.
| Alias | PCT |
|---|---|
| Interactions | The PERCENT calculation can be performed at different levels in the graph. The level can be specified with the PCTLEVEL= option in the PROC SGPLOT statement. |
| You can use the PCTNDEC= option in the SGPLOT procedure statement to control the number of decimals to be used when calculating the percent values. | |
| Note | If all of the frequencies or sums for a specified level are zero, all of the percentages for that level are zero. |
SUM
the sum of the response variable. This is the default value when you specify the RESPONSE= option.
| Interaction | For this value to take effect, you must also specify the RESPONSE= option. |
|---|
| Default | SUM when you also specify the RESPONSE= option. |
|---|---|
| FREQ when do not specify the RESPONSE= option. | |
| Restriction | If you do not also specify the RESPONSE= option, then only the FREQ or PERCENT statistic is calculated (FREQ is the default). If you specify RESPONSE=, then you can use any of the statistics. |
| Interaction | When the graph is generated, the statistic is appended to the variable name in the axis label and the legend (if it is created). However, if a label has been assigned to the variable, then the label appears in the axis label and legend instead of the statistic. |
STATLABEL | NOSTATLABEL
specifies whether the response variable statistic is displayed in the axis and legend labels. STATLABEL forces the statistic to be displayed. NOSTATLABEL removes the statistic from the axis and legend labels.
Normally, the procedure displays the statistic along with the name of the response variable. However, when a custom label is assigned to the response variable, the procedure does not display the statistic. In each case, you can control whether the statistic is displayed.
| Default | The statistic is displayed for the response variable. |
|---|---|
| When a custom label is assigned to the response variable, the statistic is not displayed. | |
| Interactions | This option has no effect unless the RESPONSE= option is specified. |
| This option has no effect if you specify the axis label using the LABEL= option in an AXIS statement. |
TIP=(variable-list) | NONE
specifies the data tip information to be displayed when the cursor is positioned over the graphics element.
(variable-list)
a space-separated list of variables enclosed in parentheses. Data tips are displayed using the data obtained from the specified variables.
NONE
| Requirement | You must specify the
IMAGEMAP option in the ODS GRAPHICS statement in order to
generate data tips. For example, add the following statement
before your procedure:
|
|---|---|
| Interaction | This option replaces all of the information that is displayed by default. |
| Notes | When TIP= is not specified, the category, RESPONSE, and GROUP variables are displayed, if applicable, when you hover over a line or marker. The category and upper limit or lower limit variables are displayed when you hover over an error bar or error bar cap. |
| When TIP= is specified, the specified variables are displayed when you hover over a line or marker. No variables are displayed when you hover over an error bar or error bar cap. | |
| Tip | Use the TIPFORMAT and TIPLABEL options to assign formats and labels to the list of variables. |
| Example | tip=(age weight) |
TIPFORMAT=(format-list)
applies formats to the list of data tip variables that you specify in the TIP= option.
Provide a space-separated list of formats enclosed in parentheses. This option provides a way to control the format of the variable data that appears in the data tips.
A one-to-one correspondence exists between the format-list and the variable-list that is specified for the TIP= option. A format must be provided for each variable, using the same order as the variable-list. If you do not want to apply a format to a variable, use the AUTO keyword instead.
| Default | The column format of the tip variable, or BEST6 if no format is assigned to a numeric column |
|---|---|
| Requirement | A format or the keyword AUTO must be provided for each variable that is listed in the TIP= option. |
| Interaction | This option has no effect unless TIP= is also specified. |
| Note | A syntax error might be generated if you specify the format using the w.d SAS format. To avoid this error condition, insert an F in front of the format name. Example: F2.0 |
| Tip | Use the TIPLABEL= option to assign labels to the list of variables. |
| See | SAS Formats and Informats: Reference |
| Example | tipformat=(auto F5.2) |
TIPLABEL=(label-list)
applies labels to the list of data tip variables that you specify in the TIP= option.
Provide a space-separated list of quoted “text strings” enclosed in parentheses. This option provides a way to specify labels for the variable data that appears in the data tips.
A one-to-one correspondence exists between the label-list and the variable-list that is specified for the TIP= option. A label must be provided for each variable, using the same order as the variable-list. If you do not want to apply a custom label to a variable, use the AUTO keyword instead.
| Requirement | A label or the keyword AUTO must be provided for each variable that is listed in the TIP= option. When AUTO is used, the label is obtained from the variable. |
|---|---|
| Interaction | This option has no effect unless TIP= is also specified. |
| Tip | Use the TIPFORMAT option to assign formats to the list of variables. |
| Example | tiplabel=(auto "Class Weight") |
TRANSPARENCY=value
specifies the degree of transparency for the plot. The transparency that you specify applies to all aspects of the plot statement.
| Default | 0.0 |
|---|---|
| Range | 0 (completely opaque) to 1 (completely transparent) |
URL=character-variable
specifies an HTML page to be displayed when parts of the plot are selected.
character-variable
specifies a variable that contains a valid HTML page reference (HREF) for each plot element that is to have an active link.
| Example | https://www.sas.com/en_us/home.html |
|---|
| Default | By default, no HTML links are created. |
|---|---|
| Interactions | This option affects HTML output only. |
This option has no effect unless you also
specify IMAGEMAP in the ODS GRAPHICS statement. For example,
add the following statement before your procedure:
For
more information, see Using the ODS GRAPHICS Statement. | |
| If your categorical chart is overlaid with other categorical charts, each chart can specify its own URL variable. The URL variable specified for each chart overlay is honored. This capability affects the following charts: DOT, HBAR, HLINE, VBAR, VLINE. | |
| Tip | Use the DRILLTARGET= option in the ODS GRAPHICS statement in order to specify the window that displays the drill-down output. |
WEIGHT=numeric-variable
specifies a variable that contains values to be used as weights for the calculations. Each observation is weighted by the value of the specified numeric variable.
| Requirement | The values of the weight variable must be greater than zero. If an observation’s weight is zero, negative, or missing, the observation is deleted from the analysis. |
|---|---|
| Interaction | If your plot is overlaid with other categorization plots that also specify WEIGHT=, then the first WEIGHT variable that you specified is used for all of the plots. |











