```Date: Thu, 16 Aug 2007 13:45:05 -0400 Reply-To: Arthur Tabachneck Sender: "SAS(r) Discussion" From: Arthur Tabachneck Subject: Re: Pie Chart and Whole Number Percents Comments: To: "Jared [n00b]" Jared, I won't bother asking if a pie chart is really what you are looking for. To do what you want, try modifying your code as follows: 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; 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; Without commenting out the percent=inside and value=none statements, you are telling SAS to ignore the actual values and, rather, calculate and print percentages. HTH, Art ---------- On Thu, 16 Aug 2007 10:04:41 -0700, webonomic wrote: >I have a dataset like the following: >Id Name Percent >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 > > >I need to have a Pie Chart of the Names for each ID. My code for that >is as follows: >proc gchart; >pie Name / discrete sumvar=Percent > NOLEGEND > SLICE=ARROW > PERCENT=INSIDE > VALUE=NONE > COUTLINE=BLACK; >by Id; >run; > >The problem is the percent number being displayed in the chart is not >very friendly becuase of the decimal places. I want whole numbers. > >My first question, is there a way to easily set that you want whole >numbers instead of the actual value? > >The way I have been trying to do it is by changing the dataset such >as: > >data rounded; set dataset; >Percent = ROUND(Percent); >run; > >When I look at the newly rounded numbers, it looks like it will do the >trick because I see no decimal places. However, my Pie Chart code >shows some of the percents as whole numbers while others still contain >decimal places. > >Can anyone shed any light on what I can do to solve this seemingly >simple problem? > >I've also tried formating the Percent variable with a picture format: > >proc format; > picture pctfmt (round) 0-high='00%'; >run; > >The reason seems to be that when rounding, some of the numbers don't >sum to 100 exactly but will add up to 99 or 101. But is there any way >around this? > > > >Jared ```

Back to: Top of message | Previous page | Main SAS-L page