« Running Shell Commands in Enterprise Guide | Main | Pie Charts - a reminder »

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.

 

 

 

Posted on Monday, March 31, 2008 by Registered CommenterJared in | CommentsPost a Comment

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>