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 .
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.