Pie Charts and Displaying Percentages
I had the following data:
data have;
input Id Name $ Percent;
percent=round(percent);
cards;
1 Jim 39.1234
1 John 60.8766
2 Jim 21.2345
2 Jack 33.5555
2 John 46.21
3 Josh 100
4 Jack 11.56
4 Jim 15.6543
4 John 25.1
4 Josh 47.6857
;
run;
and I needed to make a pie chart, but I wanted to display the numbers as percents. The following code allows you to do that:
proc gchart data=have;
format percent 3.0;
pie Name / discrete sumvar=Percent
NOLEGEND
SLICE=ARROW
/* PERCENT=INSIDE */
/* VALUE=NONE */
COUTLINE=BLACK;
by Id;
run;
quit;
It’s simple. I like it.


Reader Comments