Hi all,
I have a categorical variable in my data. I am trying to draw a bar graph for this variable based on the percents. The below code is working but the sum of percentages is not 100%. I don't know how it is calculating this. Is there an easy way to draw a percentage-based bar graph?
Thank you,
proc sgplot data=alt_listening;
title "Proficiency Level: List 1-2";
vbar listening_pl / stat=pct transparency=0.25 fillattrs=(color=black) ;
yaxis label= 'Percent' ;
xaxis label= 'Proficiency Level';
by cluster_listening;
run;
For the record, the default percentage basis is the entire graph output, including all BY-groups. To change this basis, use the PCTLEVEL option like you did set the level you want to be the basis for 100%. In SGPLOT, there are three levels: Graph (the default), BY (for BY-groups), and Group (all groups within a category = 100%). For SGPANEL, there are four levels: Graph, BY, Cell (all bars in each cell = 100%), and Group.
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.