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.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.