Date: Fri, 23 Sep 2011 14:39:43 -0700
Reply-To: "Pardee, Roy" <pardee.r@GHC.ORG>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Pardee, Roy" <pardee.r@GHC.ORG>
Subject: sgplot vbar: possible to specify order of values of a grouping
variable?
Content-Type: text/plain; charset="us-ascii"
Hey All,
On my system the below code gives me stacked bar charts where the first value in the legend & on the bars is 'medium', followed by 'old' & then 'young'. Obviously this is a bit jarring--I'd much rather they went from low-high. I tried a couple of different sort orders for the data b/c that's worked in other PROCs, but no joy.
Is it possible to specify a particular order?
Thanks!
-Roy
data gnu ;
length age_range $ 6 ;
set sashelp.class ;
select(age) ;
when (11, 12) age_range = 'young' ;
when (13, 14) age_range = 'medium' ;
otherwise age_range = 'old' ;
end ;
run ;
proc sort ;
by sex age ;
run ;
%let out_folder = C:\deleteme\ ;
ods html path = "&out_folder" (URL=NONE)
body = "deleteme.html"
;
proc sgplot ;
vbar sex / group = age_range ;
run ;
run ;
ods _all_ close ;
Roy Pardee | DATA WRANGLER
Group Health Research Institute
PHONE 360-447-8773 | 206-287-2078
E-MAIL pardee.r@ghc.org
www.grouphealthresearch.org
Group Health is people-powered. Learn more at http://www.ghc.org/annualmeeting
GHC Confidentiality Statement
This message and any attached files might contain confidential information protected by federal and state law. The information is intended only for the use of the individual(s) or entities originally named as addressees. The improper disclosure of such information may be subject to civil or criminal penalties. If this message reached you in error, please contact the sender and destroy this message. Disclosing, copying, forwarding, or distributing the information by unauthorized individuals or entities is strictly prohibited by law.