BookmarkSubscribeRSS Feed
VD
Calcite | Level 5 VD
Calcite | Level 5

Hello,

Is there an option in proc gchart (Hbar) to label data values inside the bars (without using annotate)?

I have attached an example of the required output.

Thanks.

VD


graph.JPG
5 REPLIES 5
GraphGuy
Meteorite | Level 14

VD - I don't think it's possible right now in gchart hbar, without using annotate.

There's an open R&D request in to consider adding this feature, and I've added a link to this thread so the developers will know there is customer interest in this capability.

Jay54
Meteorite | Level 14

With SAS9.3 release, you can do this using the SGPLOT procedure by overlaying a scatter plot with MarkerChar option on a VBarParm statement.  You would need to compute where to place the label since the bar is stacked, so it is similar to annotate.  For prior release, you will have to use annotate.

VD
Calcite | Level 5 VD
Calcite | Level 5

Thank you for your replies. Annotate it is then!

VD

GraphGuy
Meteorite | Level 14

Not to worry - using annotate is not that difficult!  Smiley Happy

Here's a bit of sample code to get you started...

data my_anno; set sashelp.class;
xsys='2'; ysys='2'; when='a';
midpoint=sex; subgroup=name;
function='label'; position='4'; text=name;
run;

proc gchart data=sashelp.class anno=my_anno;
hbar sex / type=sum sumvar=weight nostats
subgroup=name nolegend;
run;

VD
Calcite | Level 5 VD
Calcite | Level 5

Brilliant - thanks Robert.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 5 replies
  • 1354 views
  • 6 likes
  • 3 in conversation