## Arranging GCHART value in Descending order

Solved
Regular Contributor
Posts: 218

# Arranging GCHART value in Descending order

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;

Accepted Solutions
Solution
‎07-14-2015 04:09 PM
Regular Contributor
Posts: 218

## Re: Arranging GCHART value in Descending order

All Replies
Super Contributor
Posts: 337

## Re: Arranging GCHART value in Descending order

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

Regular Contributor
Posts: 218

## Re: Arranging GCHART value in Descending order

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,

Super User
Posts: 11,343

## Re: Arranging GCHART value in Descending order

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;

Super Contributor
Posts: 337

## Re: Arranging GCHART value in Descending order

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!

Solution
‎07-14-2015 04:09 PM
Regular Contributor
Posts: 218