Hi,
Currently I have created a stack bar graph where bar value is showed on top of each bar.
But how can I show data labels for each stack group? Something as shown below:
Following SAS code I used to generate first graph (without data label):
PROC SQL;
CREATE VIEW WORK.SORTTempTableSorted AS
SELECT T.Origin, T.Type
FROM SASHELP.CARS as T;
QUIT;
Legend1
FRAME
POSITION = (MIDDLE RIGHT OUTSIDE)
;
Axis1
STYLE=1
WIDTH=1
MINOR=
(NUMBER=1
)
;
Axis2
STYLE=1
WIDTH=1
;
PROC GCHART DATA=WORK.SORTTempTableSorted
;
VBAR3D
Origin
/
SUBGROUP=Type
SHAPE=BLOCK
FRAME TYPE=FREQ
FREQ
LEGEND=LEGEND1
COUTLINE=BLACK
RAXIS=AXIS1
MAXIS=AXIS2
;
RUN; QUIT;
What version of SAS are you using?
If you have SAS9.4M2, you can use the new SEGLABEL option to show label for each segment.
For prior releases, see:
http://blogs.sas.com/content/graphicallyspeaking/2013/09/20/stacked-bar-chart-with-segment-labels/
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.
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.