BookmarkSubscribeRSS Feed
SAS93
Quartz | Level 8

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 REPLY 1
Reeza
Super User

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.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 589 views
  • 0 likes
  • 2 in conversation