I have the following code:
/* Vertical Bar Chart */
Axis order=("NH White" "NH other" "Hispanic" "NH Black");
Proc GCHART data=WORK.RACEFLU3;
Vbar race / sumvar=rowpercent raxis=axis;
Run;
It displays the % of people vaccinated (numeric) by race/ethnicity (character). I'm trying to get those race/ethnicity categories to appear sorted by descending % on the horizontal axis (so: "NH White" "NH other" "Hispanic" "NH Black").
But whatever I'm doing above doesn't work and the suggestions I've found so far online don't really help, either.
Any ideas?
1. Sort your data before graphing.
2. Try SGPLOT + HBAR/VBAR which allows you a little more control than SAS/GRAPH.
If you need help with code, please post sample data or provide code that uses one of the datasets in the SASHELP library, such as CLASS, CARS or HEART.
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!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.