Hello all
I've created the bar chart below, and I wonder if it is possible to let the bar chart show be both the frequency and the percentage ?
code"
PROC SGPLOT DATA = sashelp.cars;
VBAR type /group=origin;
RUN;
"
function output:
wanted output examples
thanks
PROC SGPLOT DATA = sashelp.cars nocycleattrs;
VBAR type /group=origin;
VBAR type /group=origin y2axis stat=percent ;
RUN;
if it is possible to do it per type that would be great. 😄
i think in order for it to work with the percentage per type we need to write the value inside each colored portion cause otherwise the percent access needs a different bar as the percentage scale changes along the type
I found a way of adding the percent (out of total) in color like this but this losses the information of what each section of the bar represent (origin data in my example).
I wish I can keep write the percentage (and adjust it to pertype) value in the boxes instead of the frequency.
code :
PROC SGPLOT DATA = sashelp.cars;
VBAR type /group=origin COLORSTAT=PCT SEGLABEL;
RUN;
PROC SGPLOT DATA = sashelp.cars nocycleattrs;
VBAR type /group=origin;
VBAR type /group=origin y2axis stat=percent ;
RUN;
y2axis
that is just a great option.
thank you .
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.