LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (April 2005, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 6 Apr 2005 14:37:58 -0400
Reply-To:     "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Subject:      Re: chart with subgroups
Comments: To: sas-l@uga.edu

Jörg Neumann wrote: > Hello, > > i want to generate a bar chart. > My dataset includes observations with variable a and b. > a and b have less then 10 different values. > > For every value of a i want to have a bar of the different values of > b. when i run the code: > proc gchart data=daten; > vbar a / subgroup=b; > run; > i get bars with the sum of the observations for b on the level of a. > > What i want is a chart where i get for every value of a the > distribution of b. > So all bars should have the same height. > > Thanks for your help

I think this might be what you want.

---------------- %let seed = 1234;

data foo; do i = 1 to 1000; a = floor (10 * ranuni (&seed)); b = floor ( a * ranuni (&seed)); output; end; run;

proc sql; create table ab as select *, nb/sum(nb)*100 as groupPct from ( select a,b,count(b) as nb from foo group by a,b ) group by a ; quit;

proc gchart data=ab; vbar a / discrete subgroup=b sumvar=groupPct ;

run; quit; ----------------

Richard A. DeVenezia -- Learn how to customize SAS Explorer http://www.devenezia.com/downloads/sas/actions/


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