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 (February 2009, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 11 Feb 2009 22:26:41 +0530
Reply-To:   Anindya Mozumdar <anindya.lugbang@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Anindya Mozumdar <anindya.lugbang@GMAIL.COM>
Subject:   Re: PROC GCHART - counts on top of bars
Comments:   To: Anna Larbalestier <anna.larbalestier@bristol.ac.uk>
In-Reply-To:   <499300D4.5070607@bristol.ac.uk>
Content-Type:   text/plain; charset=ISO-8859-1

I think you need to outside = sum in the vbar options, i.e,

vbar visit / discrete type=sum sumvar=pcnt subgroup = viscat width=7 patternid=subgroup outside = sum;

On Wed, Feb 11, 2009 at 10:16 PM, Anna Larbalestier <anna.larbalestier@bristol.ac.uk> wrote: > Hello there > > I am trying to create a bar chart of proportions with frequency counts > on top. There is one bar for each visit. Each visit is categorised 1, > 2 or 3. Each bar is subdivided into the proportions of categories 1, 2 > and 3. All bars add up to 100%. I would like to put on top of the bars > a count of the number of observations that went into each bar. This is > the bit I can't figure out how to do. My code is as follows: > > *** Get counts of visit by visit category ***; > proc freq data = vis_count1 noprint; > table visit*viscat / out = visfreq1 (drop=percent); > run; > > *** Get counts of visit ***; > proc freq data = vis_count1 noprint; > table visit / out = visfreq2 (drop=percent rename = (count=vcount)); > run; > > *** Merge together and calculate % in each category at each visit ***; > data visfreq; > merge visfreq1 > visfreq2; > by visit; > pcnt = (count/vcount)*100; > run; > > *** Produce bar chart ***; > proc gchart data=visfreq; > vbar visit / discrete > type=sum > sumvar=pcnt > subgroup = viscat > width=7 > patternid=subgroup; > run; > quit; > > Many thanks for your help > > Anna >


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