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.

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 427 views
  • 1 like
  • 3 in conversation