BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sandeshregmi0
Calcite | Level 5

 Untitled.png

I have been trying to order above bars in the following order

CHILD(<12)

YOUTH(12-17)

YOUNG ADULT(18-25)

ADULT(26-64)

SENIOR(65+)

I couldn't figure out a way to do it in EG. Could you please provide some suggestion. Thank you

 

sandesh

 

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

The code being generated in EG for this graph is using GCHART. Your best option is probably to use the MIDPOINTS option and list out the midpoints in the order you want them. In that case, you do not have re-map your values to numbers.

 

vbar age_group / midpoints=("CHILD(<12)" "YOUTH(12-17)" ... )

 

Hope this helps!

Dan

View solution in original post

5 REPLIES 5
ballardw
Super User

Is the axis label an actual character variable or the result of formatting a numeric?

sandeshregmi0
Calcite | Level 5

It is a actual character variable.

DanH_sas
SAS Super FREQ

Is your data already in that order?

sandeshregmi0
Calcite | Level 5

Yes, they are. I even created a flag as shown below and plotted the data. This time all the bars were in order as I wanted but then I got into an issue of mapping them back. I dont know how to map like 1 back to CHILD(<12). If I dont use the flag though SAS forced all the bar appear in alphabetical order. 

CHILD(<12)1
YOUTH (12-17)2
YOUNG ADULT (18-25)3
ADULT (26-64)4
SENIOR (65+)5

 

 

DanH_sas
SAS Super FREQ

The code being generated in EG for this graph is using GCHART. Your best option is probably to use the MIDPOINTS option and list out the midpoints in the order you want them. In that case, you do not have re-map your values to numbers.

 

vbar age_group / midpoints=("CHILD(<12)" "YOUTH(12-17)" ... )

 

Hope this helps!

Dan

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1503 views
  • 0 likes
  • 3 in conversation