Hi All,
How can I change yaxis in the vbar figure? I don't need frequency, I need percentage. But I don't have a percentage column in dataset, I can got it by proc freq.
here is my code for figure:
proc freq data=lin_;
tables binary*groups;
run;
proc sgplot data=lin_;
vbar binary / group = groups groupdisplay = cluster;
run;
any idea?
Thanks,
Chen
Here is a link to the doc for the VBAR statement. If you search for "percent" on that page you will find the STAT=PERCENT option.
Hi Rich,
I tried to use stat=percent option, but what if I just want col percent for Y axis? Any way to solve this?
Thanks,
Chen
If you have a column called "percent", do this instead:
proc sgplot data=lin_;
vbarparm x=binary y=percent / group = groups groupdisplay = cluster;
run;
If you use STAT=PCT on the VBAR statement, do you get what you want?
I got group percentage, but I just want col percentage in Y axis.
Thanks,
chen
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.