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

I'm grouping a barchartparm by sites in four groups.

leaf node site, parent, that parent's parent, and Nation.

All sites have unique ID's but from time to time two unique ID's have the same label. So a leaf node might have ID=12345 and have the label 'Mysite' and it's parent site with ID=98765 might also have the label 'Mysite'.

When I send the data to a barchartparm template, of course the two groups are merged into one (and SAS issues a warning). And so I get only three groups instead of four.

 

Is there a way to get the barchartparm to recognize that they're two different groups (to look at the ID instead of the label of the ID variable) ? If not, is there a workaround so that i can present all four groups and have two of them shown with the same name?

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

In your user-defined format, try adding this label twice  but add a leading <space> to one of them. Then, assign one the unique values to these labels.

 

Hope this helps!

Dan 

View solution in original post

4 REPLIES 4
ballardw
Super User

At least show the code you are currently attempting so we know all the options you are using.

That may help.

 

But since your data has the same value for a variable you may need to modify the data.

DanH_sas
SAS Super FREQ

In your user-defined format, try adding this label twice  but add a leading <space> to one of them. Then, assign one the unique values to these labels.

 

Hope this helps!

Dan 

andypandy_swe
Obsidian | Level 7
Thank you both but I just solved it. For one of the four levels (one of the two that has the possibility of getting the same label) I added a right-align to the putc() -function in my proc format.
This makes the barchartparm template recognize it as a separate group and when the groups are listed in the legend of the graph, it isn't right aligned anymore so it looks just the way I want it.

proc format library=save.session_formats;
value $unit_output
...
'2_STEPS_DOWN'="%sysfunc(putc(&ADMINISTRATIVE_UNIT, $ORG_UNIT_NAME. -r))"
'3_STEPS_DOWN'="%sysfunc(putc(&UNIT, $ORG_UNIT_NAME.))"
...
andypandy_swe
Obsidian | Level 7
I guess my solution is pretty much what you suggested Dan...

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 4 replies
  • 1022 views
  • 0 likes
  • 3 in conversation