After creating a histogram,
you might use a density plot to fit various distributions to the data.
The most common density plot uses the normal distribution, which is
defined by the mean and the standard deviation.
A density plot can be
used by itself, combined with another density plot, and overlaid on
a histogram.
The following examples
show a density plot overlaid on a histogram. Examples are provided
for the SGPLOT and the SGPANEL procedures.
|
proc sgplot data=sashelp.class;
histogram height;
density height;
run;
|
The SGPANEL example
shows output that is paneled by gender. The UNISCALE= ROW option specifies
that only the shared row axes are identical. The column axes vary
based on the values of the height for the respective genders.
|
proc sgpanel data=sashelp.class;
panelby sex /
uniscale=row;
histogram height;
density height;
run;
|
Options are available
that enable you to customize the density plot and enhance its appearance.
For example, you can do the following:
-
control the visual attributes of
the density line.
-
specify a kernel distribution instead
of normal. You can also specify the scaling that is used for the response
axis.
-
specify legend labels and plot
transparency.
Note: This list does not
include all available options.