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 (May 2005, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 2 May 2005 18:06:44 -0400
Reply-To:     Ya Huang <ya.huang@AMYLIN.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ya Huang <ya.huang@AMYLIN.COM>
Subject:      Re: Assign colors to subgroups in GCHART VBAR
Comments: To: lgutina@GMAIL.COM

One solution is to 'fill in' all the missing type for each id, and assign the share=0 for those filled in type:

data xx; input ID type $ share; cards; 1 b 40 1 c 60 2 a 30 2 b 20 2 c 10 2 d 40 ;

/* this one get all the id and type */ proc sql; create table alltype as select distinct a.id, b.type from xx a, xx b order by a.id,b.type ;

data yy; merge xx alltype; by id type; if share=. then share=0; run;

proc gchart; vbar type / sumvar=share subgroup=type; by id; run;

Kind regards,

Ya Huang

On Mon, 2 May 2005 13:03:40 -0700, Liza <lgutina@GMAIL.COM> wrote:

>Hi, >I have the following data: > >ID type share >1 b 40% >1 c 60% > >2 a 30% >2 b 20% >2 c 10% >2 d 40% > >I am creating a gchart with 4 subgroups (type variable). Each vertical >bar can have 1 to 4 subgroups depending on how many were present in the >period. I also have a BY statement (ID variable), so that I can create >a separate chart for every ID. I'd like the coloring of bars to be >uniform across the graphs. I used the pattern statement, and I get the >following problem. If pattern1 is red, then for ID=1 type b will be >red, and for ID=2 type a will be red. That makes it difficult to >visually compare charts across all IDs. Is it possible to assign color >based on the value of subgroup (type variable in this example) or I'd >have to modify my data to look like this: > >ID type share >1 a 0% >1 b 40% >1 c 60% >1 d 0% > >2 a 30% >2 b 20% >2 c 10% >2 d 40% > >Thanks, >Liza


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