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 (April 2011, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 20 Apr 2011 16:16:02 -0500
Reply-To:     Robin R High <rhigh@UNMC.EDU>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Robin R High <rhigh@UNMC.EDU>
Subject:      Re: Graphics: inner & outer Doghnut pies for percentage
              distribution (comparison)
Comments: To: Irin later <irinfigvam@YAHOO.COM>
In-Reply-To:  <952597.90351.qm@web39423.mail.mud.yahoo.com>
Content-Type: text/plain; charset="UTF-8"

Irin,

Though I totally agree with Peter about pie plots, it is interesting to see how SAS combines donuts and pies for a tasty snack .. perhaps this is a start (after adjusting your goptions), but there are a multitude of better ways for comparing the percent distribution of two types of percents for categorical, namely where the pie slices line up showing percents for each level race can be down-right confusing.

data pdt(keep=race employees members) plt(keep=grp race perc); INPUT Race $16. Employees Members ; OUTPUT pdt; grp='Employees'; perc=Employees; OUTPUT plt; grp='Members'; perc=Members; OUTPUT plt; cards; White 60 40 African American 15 20 Hispanic 17 24 Asian 6 10 Other 2 6 ;

proc sort data=plt ; by grp race; run; proc print data=plt NOObs n; run;

proc print data=pdt NOObs n; run;

goptions reset=all Hsize=10 in Vsize=8 in htext=2;

legend1 position = (right middle outside) label=(h=2) value=(h=2) across=1 down=5; proc gchart data=pdt ; pie race / percent=inside sumvar=employees radius= 20 noheading coutline= none name="pie" legend=legend1; donut race / percent=outside sumvar=Members radius =30 donutpct=60 noheading coutline=black name="don" legend=legend1; TITLE; run; quit;

proc greplay igout=gseg tc=sashelp.templt nofs; template whole; treplay 1:pie 1:don; run; quit;

* a vertical bar graph that allows side-by-side comparisons of percents by levels of race is much clearer, if that is your objective;

axis1 length = 12 in value=(h=1.5) ; axis2 length=6.75 in value=(h=2) minor=none label=(a=90 h=2.5 'Percent'); proc gchart data=plt; vbar grp / Noframe sumvar = perc coutline=black group=race space=3 width=8 gspace=5 maxis=axis1 raxis=axis2; TITLE; run; quit;

Robin High UNMC

From: Irin later <irinfigvam@YAHOO.COM> To: SAS-L@LISTSERV.UGA.EDU Date: 04/19/2011 08:28 PM Subject: Graphics: inner & outer Doghnut pies for percentage distribution (comparison) Sent by: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>

For the comparison purposes I need to create SAS code for two Doughnut Pies Clustered by Race based on the data set. For ex:

Race Employees Percent Members Percent

White 60 40 African American 15 20

Hispanic 17 34 Asian 6 3 More races 2 3

The inner Dougnut pie (like a ring) should represent Employees’ race percentage distribution while an outer Doughnut pie should show members race percentage distribution. The inner one does not have breaks at all while an outer does as it is located around the inner one

I also need a legend. For ex

Blue color box-White Pink -African American Green -Spanish Purple -Asian light blue More races

Could you give me a hand with SAS 9.2 code?

Thank you in advance,

Irin


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