Previous Page | Next Page

The SGPLOT Procedure

Example 7: Combining Histograms with Density Plots


Procedure features:

HISTOGRAM statement

DENSITY statement

KEYLEGEND statement

Sample library member: GSGPLHST

[GSGPLHST - Combining Histograms with Density Plots]

This example shows a histogram combined with two density plots. One density plot uses a normal density estimate and the other density plot uses a kernel density estimate.

 Note about code
proc sgplot data=sashelp.heart;
  title "Cholesterol Distribution";
  histogram cholesterol;
 Note about code
  density cholesterol;
  density cholesterol / type=kernel;
 Note about code
  keylegend / location=inside position=topright;
run;

Previous Page | Next Page | Top of Page