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

I have a dataset I am trying to annotate to a PROC GCHART graphic. The annotation data ranges from 0-100% for a stacked bar graph containing two subgroups. Whenever there is a 0% present the annotated data does not display on the graph. Everything else displays fine.

 

It works just fine when all values are above 0%. My question is, how do I get annotated values to display even if no value possible on the graph? Here is my annotation code:

 

data maddr;

set WORK.MONTHLY_ADDRESS_RESULTS;

retain xsys "2" ysys "2" position "E" /*color "white" /*outline "black"*/;

size=1.2;

style="/bold";

*%system(3,2);

when="a";

midpoint=Month;

subgroup=Type;

*y=20;

if Total = 0 then Total=0; else text=left(put(Total,percent8.1));

output;

run;

1 ACCEPTED SOLUTION

Accepted Solutions
GraphGuy
Meteorite | Level 14

In a Gchart bar chart, if you're annotating things on the stacked bar segments (ie, subgroups), and if a subgroup has a value of zero (and the subgroup is not drawn on the chart), then how will annotate know where to draw that annotation?

 

You could perhaps modify the data a little, and if the value is 0, then make it slightly more than zero (like .00001) - then a tiny slivery of a segment would be created for it in the bar, and annotate would have something to annotate on.

 

But perhaps it would be best to re-think this, and use something other than a stacked bar chart.

View solution in original post

2 REPLIES 2
GraphGuy
Meteorite | Level 14

In a Gchart bar chart, if you're annotating things on the stacked bar segments (ie, subgroups), and if a subgroup has a value of zero (and the subgroup is not drawn on the chart), then how will annotate know where to draw that annotation?

 

You could perhaps modify the data a little, and if the value is 0, then make it slightly more than zero (like .00001) - then a tiny slivery of a segment would be created for it in the bar, and annotate would have something to annotate on.

 

But perhaps it would be best to re-think this, and use something other than a stacked bar chart.

NathanOch
Obsidian | Level 7
I actually received this solution from SAS support as well. Changed the zero values to 0.00001 allowed everything to display from the annotation dataset. Thanks so much for your help!
Nate

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
  • 2 replies
  • 874 views
  • 0 likes
  • 2 in conversation