|
On Wed, 7 Mar 2012 10:28:24 -0500, vivian v <v.vivian3@GMAIL.COM> wrote:
>Hi, all,
>I have a data like the following:
>
>response group
>1.23 A
>2.34 A
>3.24 A
>5.46 B
>4.34 B
>........
>
>Suppose I have 4 groups. How can I draw 4 density plots for each group
and
>overlay on one figure? Thanks!
You can use PROC UNIVARIATE to draw comparative histogram where each
density is in its own panel.
To overlay them in a single plot:
1) Reshape the data so that each group becomes a variable, using the
technique described in http://blogs.sas.com/content/iml/2011/11/04/reshape-
data-so-that-each-category-becomes-a-new-variable/
2) Use SGPLOT to overlay the densities, using the technique shown in
http://blogs.sas.com/content/iml/2012/01/13/overlay-density-estimates-
on-a-plot/
If you also want histograms, see
http://blogs.sas.com/content/graphicallyspeaking/2012/02/06/comparative-
densities/
Rick Wicklin
Statistical programming and SAS/IML blog: http://blogs.sas.com/content/iml
|