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 (January 2001, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 25 Jan 2001 12:35:27 -0500
Reply-To:   Richard DeVenezia <radevenz@IX.NETCOM.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Richard DeVenezia <radevenz@IX.NETCOM.COM>
Organization:   MindSpring Enterprises
Subject:   Re: proc gchart: controlling patterns when using a by statement

Bill:

If drc_1 is numeric: --------------------- Not sure how you would ever get what you want (generically) since patternid=midpoint. If there are different distributions of values in the different by groups, the default midpoint algorithm will calculate different midpoint ticks.

You would need to ensure common midpoints in all by groups specifying either of these options MIDPOINTS=<value-list> or a MAXIS=<axis-N>. You can also look into the DISCRETE option or the G100 option.

You would need to preprocess the data to populate a macro variable with the midpoint value list common across all groups.

If drc_1 is character: --------------------- GCHART defaults to DISCRETE

I will assume drc_1 is character and show you a way to add phony data to ensure all midpoints are contributed to the chart, however, since the phony data is zeroed, the midpoint will not appear (but will ensure patternid's are consistent across by groups)

data fake; do weekstrt = 1 to 10; range = int (10 * ranuni(0)); start = int (16 * ranuni(0)); N = 10 + int (15 * ranuni (0)); do j = 1 to N; * drc_1 = start + int (range * ranuni(0)); drc_1 = byte (64 + start + int (range * ranuni(0))); output; end; end; keep weekstrt drc_1; run;

* calculate percentages used in vbar freq= option;

proc freq noprint data=fake ; by weekstrt; table drc_1 / out=drc (rename=percent=pct); run;

proc sql; * enumerate all drc_1 values in all by groups with a near zero percentage; create view alldrc as select * , 0 as pct from (select unique weekstrt from drc) , (select unique drc_1 from drc) order by weekstrt, drc_1 ; quit;

* ensure those groups without matching drc_1 values get a phony 0 percentage; data drcvbar / view = drcvbar; merge alldrc drc; by weekstrt drc_1; run;

proc gchart data=drcvbar ; by weekstrt; vbar drc_1/freq=pct descending patternid=subgroup /* sugroup is the default, but stating it clears things up */ subgroup=drc_1 /* note, same as vbar variable */ nolegend ; run; quit;

-- Richard DeVenezia - SAS Macros and AF Tools http://www.devenezia.com

"Droogendyk Bill" <bill_droogendyk@DOFASCO.CA> wrote in message news:B34F74865B47D2119E9D0000F8B844710BDE126D@DFSPO02.dofasco.ca... > Folks: > > I'm using proc gchart with a by statement. The various by groups do not all > have all of the same variable values. How do I force gchart to use the same > pattern for each value, regardless of its position on the chart? > > Code snippet below > pattern1 v=s r=1; > proc gchart data=drc; > by weekstrt; > vbar drc_1/freq=pct /*not all drc_1 values occur within all weekstrt > values*/ > descending > patternid=midpoint > ; > > Any hints appreciated > > tia, > > W.(Bill) Droogendyk > Quality Systems > Dofasco Inc. Hamilton ON Canada > Telephone: 905 548 7200 x3359 > Fax: 905 548 4007 > > Still using MS toys? XLR82SAS!


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