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
Jörg Neumann wrote:
> 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;
> 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;
do i = 1 to 1000;
a = floor (10 * ranuni (&seed));
b = floor ( a * ranuni (&seed));
create table ab as
select *, nb/sum(nb)*100 as groupPct
select a,b,count(b) as nb
group by a,b
group by a
proc gchart data=ab;
Richard A. DeVenezia -- Learn how to customize SAS Explorer