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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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
  • 324 views
  • 1 like
  • 3 in conversation