BookmarkSubscribeRSS Feed
morganmetzger
Calcite | Level 5

Hello, I am trying to change the order of my vertical bar chart. I attached a word document of them for reference. The first one is how they are supposed to look in the order of Iowa, Mississippi, Utah. Mine are coming up in a different order and was wondering how I can program them to come up in the same order as the first graph.

Thanks!

2 REPLIES 2
mlensing
Obsidian | Level 7

One workaround you could try would be to assign numeric values to each of the states (maybe in a temp dataset first), use a proc sort to sort the states in ascending alphabetical order, and then assign format names of each state names to have your states appear in the correct order on your graph..

 

This SAS Communities post also seems to have a similar situation to yours with other solutions you could try.

 

ballardw
Super User

Microsoft office documents are likely sources of macro viruses and such. So many on this forum will not open them from either individual or organization policy.

 

Code should be shared as text pasted into a code box opened on the forum with either the </> or "running man" icon.

 

The VBAR statement has an option CATEGORYORDER= which can take the parameter of

RESPASC (ascending order) or RESPDESC (descending order).

 

Be aware that with character values capitalization and leading spaces can be used in determining order and may not match expected order.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 2 replies
  • 782 views
  • 1 like
  • 3 in conversation