All,
I'm trying to add data labels into a stacked bar graph.
Part of my data looks like this:
Category | Per | EVENT_DT |
ATTPerc | 67.16% | 25/09/2017 |
AHoldPerc | 12.29% | 25/09/2017 |
ACWPerc | 20.55% | 25/09/2017 |
ATTPerc | 68.25% | 26/09/2017 |
AHoldPerc | 12.18% | 26/09/2017 |
ACWPerc | 19.57% | 26/09/2017 |
ATTPerc | 68.11% | 27/09/2017 |
AHoldPerc | 12.57% | 27/09/2017 |
ACWPerc | 19.32% | 27/09/2017 |
ATTPerc | 67.87% | 28/09/2017 |
AHoldPerc | 11.28% | 28/09/2017 |
ACWPerc | 20.84% | 28/09/2017 |
ATTPerc | 69.01% | 29/09/2017 |
AHoldPerc | 12.09% | 29/09/2017 |
ACWPerc | 18.90% | 29/09/2017 |
ATTPerc | 67.98% | 2/10/2017 |
AHoldPerc | 11.91% | 2/10/2017 |
ACWPerc | 20.12% | 2/10/2017 |
proc sgplot data=work.AHT_OTH_PercCalc;
vbar EVENT_DT / response=Per Group=Category datalabel seglabel ;
YAXIS max=1 Label="Percentage" Values=(.1 to 1 by .05);
run;
I have tried datalabel seglabel however only the datalabel is showing in the chart.
How can I get the datalabels to show?
All help appreciated.
Cheers
Dean
Hi Dean,
With SAS9.4TS1M2, this is the output I get using your data and program.
If you add the "seglabelattrs=(size=8)" instructions, what is the result?
Cheers,
Damo
Hi @DME790
Are you trying to display the value of the PER variable?
As per the documentation, SEGLABEL should do the trick but it is new with SAS 9.4M2.
Which version are you using?
If you try to use Sample 55866 (Use the SEGLABEL option to label bar segments in a bar chart, what is the result?)
Cheers,
Damo
Hi @Damo,
I can run Sample 55866 and it shows the segment results
I have got seglabel in the code however it doesn't display the segment values in the bars.
I am using 9.4 m2
proc sgplot data=work.AHT_OTH_PercCalc;
vbar EVENT_DT / response=Per Group=Category stat=SUM datalabel seglabel ;
YAXIS max=1 Label="Percentage" Values=(.1 to 1 by .05);
run;
It shows the datalabel at the top of the bars but not the segments.
Cheers
Dean
Hi Dean,
With SAS9.4TS1M2, this is the output I get using your data and program.
If you add the "seglabelattrs=(size=8)" instructions, what is the result?
Cheers,
Damo
Hi @Damo,
It is now showing the per values. Not sue what happened as I haven't changed any code - feel silly now.
Thanks for all the support.
Cheers
Dean
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.