Hello,
I'm trying to create a simple pie chart in SAS to eventually export into Excel as a graph (user request). I'm trying everything I know but I can't get percentages to show and calculate. Here's what I have
instead of the numbers (1000, 450, 6445) I want it to show 13%, 6%, and 82%. And since the values can always flip, I want the first to show amber, 2nd to show green, 3rd to show red even if the percentages are 54%, 22%, and 24%.
Would someone help me please? Google isn't my friend this Friday afternoon. Thank you!
Now you could use PROC SGPIE to get pie chart.
title "Regional Sales";
data test;
input rating $ count;
datalines;
Amber 1000
Green 450
Red 6445
;
run;
proc sgpie data=test;
donut rating / response=count holevalue datalabeldisplay=(percent)
holelabel="Total Sales" datalabelloc=outside;
run;
title "Regional Sales";
data test;
input rating $ count;
datalines;
Amber 1000
Green 450
Red 6445
;
run;
proc sgpie data=test;
pie rating / response=count datalabeldisplay=(percent)
datalabelloc=inside;
run;
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.