BookmarkSubscribeRSS Feed
Fluorite | Level 6

I have  an HBAR GCHART that is currently annoted with count values centered inside the bar which is subgrouped by month. Kind of like this example.Each bar is a day of the week... each subdivision a month.


|         400    |        900                    |                      3000                                                       |            500                    |



To do this I created a middle data set and calculated the center and values for each of the amounts. What I would like to do now is add the total to the end of the bar, outside the bar.   |  4800   for example.

But I can't figure out how to do this. My current program (without data) is attached.

Meteorite | Level 14

I've created a short example using sashelp.class to demonstrate one way to annotate values at the ends of the Hbars ...


data anno_in_bar; set sashelp.class;
xsys='2'; ysys='2'; when='a';
midpoint=sex; subgroup=name;
function='label'; position='4'; text=trim(left(name));


proc sql;
create table anno_end_bar as
select unique sex, sum(height) as total_height
from sashelp.class
group by sex;
quit; run;

data anno_end_bar; set anno_end_bar;
xsys='2'; ysys='2'; when='a';
midpoint=sex; x=total_height;
function='label'; position='6'; text='20'x||'Total='||trim(left(total_height));


data anno_all;
length text $50;
set anno_in_bar anno_end_bar;


pattern1 v=s color=yellow repeat=50;
proc gchart data=sashelp.class anno=anno_all;
hbar sex / type=sum sumvar=height nostats subgroup=name nolegend;





Time is running out to save with the early bird rate. Register by Friday, March 1 for just $695 - $100 off the standard rate.


Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 


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
  • 1 reply
  • 2 in conversation