Data visualization with SAS programming

Point labels in proc gchart

Reply
Frequent Contributor
Frequent Contributor
Posts: 94

Point labels in proc gchart

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

Attachment
SAS Employee
Posts: 967

Re: Point labels in proc gchart

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.

SAS Super FREQ
Posts: 1,081

Re: Point labels in proc gchart

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.

Frequent Contributor
Frequent Contributor
Posts: 94

Re: Point labels in proc gchart

Thank you for your replies. Annotate it is then!

VD

SAS Employee
Posts: 967

Re: Point labels in proc gchart

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;

Frequent Contributor
Frequent Contributor
Posts: 94

Re: Point labels in proc gchart

Brilliant - thanks Robert.

Ask a Question
Discussion stats
  • 5 replies
  • 317 views
  • 6 likes
  • 3 in conversation