I have something like attached. Is there a way to change the y axis to % while keeping the annotated actual count above the bars? (i.e. change response to pct but the 56.5, 62.8 etc above the bars?)
Percent of what? I don't understand how this applies to heights.
crude example, shouldn't have used heights... just used it as the visualization. pretend it is count data. Want % each bar contributes to the total count (if the heights were counts)
I think you need to pre-summarize the data so that the input data contains a Count for each category. Then you can use STAT=PCT to set the Y axis and use DATALABEL=Count to specify the bar labels:
/* create bar chart of counts by age */
proc means data=sashelp.class;
class age;
var height;
output out=ClassSummary N=Count;
run;
proc sgplot data=ClassSummary;
vbar age / freq=Count stat=pct datalabel=Count;
run;
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.
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.
Ready to level-up your skills? Choose your own adventure.