The legend text are not what I defined in Format. Does any one know why? The Diabetes_cat variable only has 1, 2, 3, but the legend has 1.2 and 1.8
proc format library=data; value Diabetes_cat 1='Normal' 2='Prediabetic' 3='Diabetic' ; run; legend2 label=('Diabetes') ; proc gchart data=data.freq4chart2; donut Diabetes_cat / sumvar=count PERCENT=INSIDE subgroup=AgeGroup2 donutpct=20 noheading legend=legend2; run;
Add the DISCRETE option to the DONUT statement and let me know if you get the expected results
proc format lib=data; value site 1=Sydney 2=Atlanta 3=Paris ; run; data totals; length dept $ 7 ; input dept site quarter sales; format site site.; datalines; Parts 1 1 7043.97 Parts 2 1 8225.26 Parts 3 1 5543.97 Tools 1 4 1775.74 Tools 2 4 3424.19 Tools 3 4 6914.25 ; legend1 ; proc gchart data=totals; format sales dollar8.; donut site / sumvar=sales subgroup=dept donutpct=30 label=("All" justify=center "Quarters") noheading legend=legend1; run;
Another Example already rebuilt such result.
Add the DISCRETE option to the DONUT statement and let me know if you get the expected results
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.