Hi I need some helps with sgplot.
I wish to build a couple of stacked bar chart with the code samples as below
proc sgplot data=mydata noborder pctlevel=group;
by Label notsorted;
styleattrs datacolors=(bigb bibg bio brown yellow red) ;
vbar Day/group=Grade stat= pct groupdisplay=stack fill grouporder=ascending missing;
xaxis integer values=(1 2 3 4 5 6 7);
run;At first, I want to make a 100% stacked bar chart (including missing value) on each Day. My data has 5 grade: 0,1,2,3,4 and missing data (display as "." bcs Grade is numeric variable)
And now I encounter 2 problems:
- How can I retain the percentage of other values on the bar on each day if I don't want the percentages of missing value and grade 0 to be displayed on my chart ?
- How can I fix the color code with each value eg I want missing value to be display with bigb color (as the order shown in datacolors= syntax)
Thanks in advance.
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.