LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (March 2012, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 7 Mar 2012 10:50:46 -0500
Reply-To:   Rick Wicklin <Rick.Wicklin@SAS.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Rick Wicklin <Rick.Wicklin@SAS.COM>
Subject:   Re: about overlay plots in the proc sgplot

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


Back to: Top of message | Previous page | Main SAS-L page