Hi All,
Can anyone tell me how to arrange the following gchart value (mean in the Y axis) in descending order? Thanks.
proc gchart data=Have;
vbar Name / discrete type=mean
inside=mean width=20
sumvar=Height mean;
run;
quit;
Thanks Miguel, that's very helpful.
it depends on the your values.
for example:
axis1 order=(50 to 10 by -5);
google "sas axis descending order" and you will see doc and papers with examples.
link to one of those here SAS/GRAPH(R) 9.2: Axis statement
I hope it helps,
-Miguel
Hi Miguel,
I google it but don;t understand much from there. What I wanted my vertical bars to show up in descending order. Let's say my highest mean is 12 and lowest is 1, what would be the code for it can you please write it for me?
proc gchart data=Have;
vbar Name / discrete type=mean
inside=mean width=20
sumvar=Height mean;
run;
quit;
Thanks,
For best control with Gchart it is often easiest to presummarize the data, sort as needed and then chart the result.
proc summary data = have nway;
class name;
var height;
output out = want mean=;
run;
proc sort data=want; by descending height; run;
proc gchart data=want;
vbar Name / discrete type=mean
inside=mean width=20
sumvar=Height mean;
run;
quit;
I googled a bit more to find a paper with an example of what we are looking for. Cool thing about SAS is all info is out there.
It turns out this proc supports an option for descending. Just add it after the slash "/". An example below.
proc gchart data=sashelp.baseball;
vbar
team / discrete type=mean
inside=mean width=20
sumvar=nhits mean descending;
run;
quit;
Good luck!
Thanks Miguel, that's very helpful.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.
Find more tutorials on the SAS Users YouTube channel.