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
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 save with the early bird rate—just $795!
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.