| TEMPLATE Procedure: Plot Statements (Experimental) |
| DENSITYPLOT numeric-column | expression < / <distribution option> <option(s)>> ; |
| Usage Information |
Density Histogram
![[Density Histogram]](./images/density.gif)
| Tip: |
A typical DENSITYPLOT statement specifies either the NORMAL or the KERNEL distribution option. Thus, one common plot syntax would be one of the following statements.
DENSITYPLOT numeric-column / NORMAL()
Another common plot syntax would be:
DENSITYPLOT numeric-column / KERNEL() |
| Tip: |
If no distribution option is specified, then NORMAL is assumed. |
| Tip: |
If more than one distribution option is specified, then the last distribution option specified is used. |
| Required Arguments |
specifies a numeric column of data values that are used to calculated the parameters for the probability distribution.
specifies a selective, relational, or logical program structure that calculates values when those values are not stored in the data.
| Distribution Options |
specifies a non-parametric kernel density estimate. The general form of the kernel density estimator is as follows.
![[untitled graphic]](./images/kernel.gif)
In
the equation, K0 (.)
is the weight function,
is the bandwidth, n
is the sample size, and xi is the ith observation. You can use the C= sub-option to specify the bandwith
and the WEIGHT= sub-option to specify the weight function K0 (.).
For more information, see the discussion of Kernel Density Estimates for the UNIVARIATE procedure in the Base SAS Procedures Guide, Volume 3.
| C |
specifies the number that represents the standardized bandwidth.
| ||||
| WEIGHT |
specifies a weight function.
|
specifies a normal density estimate, with mean and standard deviation. The fitted density function equation is as follows.
![[untitled graphic]](./images/normal.gif)
In the equation,
is the mean, and
is the standard deviation (
> 0). You can specify
with the MU= sub-option and
with the SIGMA=
sub-option. By default, ODS estimates
with the sample mean and
with the sample standard deviation.
For more information, see the discussion of Kernel Density Estimates for the UNIVARIATE procedure in the Base SAS Procedures Guide, Volume 3.
| Tip: | If mean and standard deviation are not specified, then they are calculated from the data. |
| MU |
specifies the mean. |
| SIGMA |
specifies the standard deviation. |
| 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 color. |
| DATATRANSPARENCY= number | Specifies the degree of the transparency of the density curve. |
| GRIDTRANSPARENCY= number | Specifies the degree of the transparency of the grid lines. |
| LEGENDLABEL= 'string' | Specifies the label of the legends. |
| LINECOLOR= color | style-reference | Specifies the color of the density curve line. |
| LINEPATTERN= line | style-reference | Specifies the pattern of the density curve line. |
| LINETHICKNESS= dimension | style-reference | Specifies the thickness of the density curve line. |
| NAME= 'string' | Assigns a name to a plot statement for reference in other template statements. |
| TRANSPARENCY= number | Specifies the degree of the transparency of the density curve, background, grid, axis elements, and wall, if displayed in the graph. |
| WALLTRANSPARENCY= number | Specifies the degree of the transparency of the plot wall. |
| XAXIS= X | X2 | Specifies whether curve is mapped to the primary X axis or the secondary X (X2) axis. |
| XAXISOPTS= ( axis-options ) | Specifies one or more X axis options. |
| XGRID= boolean | Specifies whether the grid lines are drawn at the tick marks. |
| XMAX= number | Specifies the maximum X value to use in the display of the curve. |
| XMIN= number | Specifies the minimum X value to use in the display of the curve. |
| XOFFSETMAX= number | Specifies an offset to add to the end that represents high data values on the primary X axis. |
| XOFFSETMIN= number | Specifies an offset to add to the end that represents low data values on the primary X axis. |
| YAXIS= Y | Y2 | Specifies whether curve is mapped to the primary Y axis or the secondary Y (Y2) axis. |
| YAXISOPTS= ( axis-options ) | Specifies one or more Y axis options. |
| YGRID= boolean | Specifies whether the grid lines drawn at the tick marks. |
| YMAX= number | Specifies the maximum Y value to use in the display of the curve. |
| YMIN= number | Specifies the minimum Y value to use in the display of the curve. |
| YOFFSETMAX= number | Specifies an offset to add to the end that represents high data values on the primary Y axis. |
| YOFFSETMIN= number | Specifies an offset to add to the end that represents low data values on the primary Y axis. |
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 degree of the transparency of the density curve.
| Default: | 0 |
| Range: | 0 (opaque) to 1 (entirely transparent) |
| Interaction: | The DATATRANSPARENCY= option overrides the TRANSPARENCY= option for the graph elements in the data area. |
specifies the degree of the transparency of the grid lines.
| Default: | 0 |
| Range: | 0 (opaque) to 1 (entirely transparent) |
| Interaction: | The GRIDTRANSPARENCY= option overrides the TRANSPARENCY= option for the grid lines. |
| 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 legends.
| Default: | An empty string. |
specifies the color of the density curve line.
| Default: | Specified by the GraphDataDefault:ContrastColor style reference. |
specifies the pattern of the density curve line.
| Default: | SOLID |
specifies the thickness of the density curve line.
| Default: | 1 px |
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 degree of the transparency of the density curve, background, grid, axis elements, and wall, if displayed in a graph.
| Default: | 0 |
| Range: | 0 (opaque) to 1 (entirely transparent) |
| Interaction: | The transparency for the density curve, background, grid, and wall can be set individually with the BACKTRANSPARENCY=, DATATRANSPARENCY=, GRIDTRANSPARENCY=, and WALLTRANSPARENCY= options. If you specify the TRANSPARENCY= option for a graph, then the individual transparency options can be specified to override it for individual features. The settings remain in effect for other features that are not individually overridden. |
| Interaction: | In an OVERLAY LAYOUT block, the TRANSPARENCY= option only affects the density curve. The LAYOUT OVERLAY statement settings control the transparency of the background, grid, axis elements, and wall. |
specifies the degree of the transparency of the plot wall.
| Default: | 0 |
| Range: | 0 (opaque) to 1 (entirely transparent) |
| Interaction: | The WALLTRANSPARENCY= option overrides the TRANSPARENCY= option for the graph wall. |
| Interaction: | Ignored in a LAYOUT OVERLAY block. For information, see Ignored Plot Options in a LAYOUT OVERLAY Block. |
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 one or more X axis options.
| Requirement: | The list of axis options must be enclosed in parentheses and separated by spaces. |
| Interaction: | Ignored in a LAYOUT OVERLAY block. For information, see Ignored Plot Options in a LAYOUT OVERLAY Block. |
specifies whether the grid lines are drawn at the tick marks.
| Default: | FALSE | ||||||
| Interaction: | Ignored in a LAYOUT OVERLAY block. For information, see Ignored Plot Options in a LAYOUT OVERLAY Block. | ||||||
| Interaction: |
If you specify or use the default
XGRID= option for the OVERLAY LAYOUT statement, then the XGRID= option specified
for a graph is ignored. Default characteristics for the grid lines are specified
from the following attributes on the GraphGridLines style element:
|
specifies the maximum X value to use in the display of the curve.
| Default: | The default value is the maximum X value in the curve. |
| Tip: | If the curve contains values greater than the number specified for the XMAX= option, then the values are excluded from the plot. |
specifies the minimum X value to use in the display of the curve.
| Default: | The default value is the minimum X value in the curve. |
| Tip: | If the curve contains values that are less than the number specified for the XMIN= option, then the values are excluded from the plot. |
specifies an offset to add to the end that represents high data values on the primary X axis. The offset is expressed as a decimal proportion of the full axis length. For a continuous axis, the offset is added to the highest data value or highest tick value, whichever is greater. For a discreet axis, the offset is added to the highest data value, which is always the highest tick value.
| Default: | Generated as suitable for the graph. |
| Range: | 0 - 1 |
| Interaction: | For a continuous axis, the offset is added after any threshold adjustment is made to the axis. |
| Interaction: | Ignored in a LAYOUT OVERLAY block. For information, see Ignored Plot Options in a LAYOUT OVERLAY Block. |
| Main discussion: | THRESHOLDMAX= sub-option. |
specifies an offset to add to the end that represents low data values on the primary X axis. The offset is expressed as a decimal proportion of the full axis length. For a continuous axis, the offset is added to the lowest data value or lowest tick value, whichever is less. For a discreet axis, the offset is added to the lowest data value, which is always the lowest tick value.
| Default: | Generated as suitable for the graph. |
| Range: | 0 - 1 |
| Interaction: | For a continuous axis, the offset is added after any threshold adjustment is made to the axis. |
| Interaction: | Ignored in a LAYOUT OVERLAY block. For information, see Ignored Plot Options in a LAYOUT OVERLAY Block. |
| Main discussion: | THRESHOLDMAX= sub-option. |
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 one or more Y axis options.
| Requirement: | The list of axis options must be enclosed in parentheses and separated by spaces. |
| Interaction: | Ignored in a LAYOUT OVERLAY block. For information, see Ignored Plot Options in a LAYOUT OVERLAY Block. |
specifies whether grid lines are drawn at the tick marks.
| Default: | FALSE | ||||||
| Interaction: | Ignored in a LAYOUT OVERLAY block. For information, see Ignored Plot Options in a LAYOUT OVERLAY Block. | ||||||
| Interaction: |
If you specify or use the default
YGRID= option for the OVERLAY LAYOUT statement, then the YGRID= option specified
for a graph is ignored. Default characteristics for the grid lines are specified
from the following attributes on the GraphGridLines style element:
|
specifies the maximum Y value to use in the display of the curve.
| Default: | The default value is the maximum Y value in the curve. |
| Tip: | If the data contains values that are greater than the number specified for the YMAX= option, then the values are excluded from the plot. |
specifies the minimum Y value to use in the display of the curve.
| Default: | The default value is the minimum Y value in the curve. |
| Tip: | If the data contains values that are less than the number specified for the YMIN= option, then the values are excluded from the plot. |
specifies an offset to add to the end that represents high data values on the primary Y axis. The offset is expressed as a decimal proportion of the full axis length. For a continuous axis, the offset is added to the highest data value or highest tick value, whichever is greater. For a discreet axis, the offset is added to the highest data value, which is always the highest tick value.
| Default: | Generated as suitable for the graph. |
| Range: | 0 - 1 |
| Interaction: | For a continuous axis, the offset is added after any threshold adjustment is made to the axis. |
| Interaction: | Ignored in a LAYOUT OVERLAY block. For information, see Ignored Plot Options in a LAYOUT OVERLAY Block. |
| Main discussion: | THRESHOLDMAX= sub-option. |
specifies an offset to add to the end that represents low data values on the primary Y axis. The offset is expressed as a decimal proportion of the full axis length. For a continuous axis, the offset is added to the lowest data value or lowest tick value, whichever is less. For a discreet axis, the offset is added to the lowest data value, which is always the lowest tick value.
| Default: | Generated as suitable for the graph. |
| Range: | 0-1 |
| Interaction: | For a continuous axis, the offset is added after any threshold adjustment is made to the axis. |
| Interaction: | Ignored in a LAYOUT OVERLAY block. For information, see Ignored Plot Options in a LAYOUT OVERLAY Block. |
| Main discussion: | THRESHOLDMAX= sub-option. |