Stalk bar chart in controlled order in SAS -


i want create stlak bar charts, column workscope having hsb,ohs,res. want reorder workscope in order of ohs,hsb,res in stalk bar. default taking in alphabetical order. how can achieve it.

goptions reset=all;     goptions colors=(red blue green);     legend1   label=none      order=('ohs' 'hsb' 'res');      proc gchart data=finalrepv3;     vbar year / discrete type=sum sumvar=value      subgroup=workscope legend=legend1 ;     run; 

you can create sorting variable beforehand, use sort input data , plot using proc sgplot xaxis discreteorder = data.

/* create dummy sorting variable */ data want;   set finalrepv3;   if workscope = "ohs" _sort = 1;   if workscope = "hbs" _sort = 2;   if workscope = "res" _sort = 3; run;  /* put data in required order */ proc sort data = want;   _sort; run;  /* create plot */ proc sgplot data = want;   vbar year / group = workscope response = value stat = sum;   /* request x axis respect data's order */   xaxis discreteorder = data; run; 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -