Chapter Contents

Previous

Next
The GCHART Procedure

Example 10: Ordering and Labeling Slices in a Pie Chart


Procedure features:
PIE statement options:
CFILL=
MIDPOINTS=
PERCENT=ARROW
SLICE=ARROW
SUBGROUP=
VALUE=NONE
Sample library member: GR13N10

[IMAGE]

This example produces a pie chart of sources of energy production for 1995. The labeled slices represent the percent of total production for each source. Instead of the sum statistic, each slice displays the percent each midpoint contributes to the whole pie. Arrows connect the midpoint labels to the slices, which are arranged by the MIDPOINTS= option so that the small slices are not next to each other and their labels do not overlap.
 Note about code
libname reflib 'SAS-data-library';
goptions reset=global gunit=pct border cback=white
         colors=(black blue green red cyan lime gray)
         ftext=swiss ftitle=swissb htitle=6 htext=4;
 Note about code
data reflib.enprod;
   length engytype $ 8;
   input year engytype produced;
   datalines;
1985 Coal      19.33
1985 Gas       19.22
1985 Petro     18.99
...more data lines...
1995 Hydro      3.21
1995 Geotherm    .31
1995 Biofuels   2.95
;
 Note about code
title 'Sources of Energy, 1995';
footnote h=3 j=r 'GR13N10 ';
 Note about code
proc gchart data=reflib.enprod (where=(year=1995));
     pie engytype / sumvar=produced
                    other=0
                    midpoints='Coal' 'Geotherm' 'Petro'
                              'Biofuels' 'Gas' 'Nuclear'
                              'Hydro'
                    value=none
                    percent=arrow
                    slice=arrow
                    cfill=cyan
                    noheading;
run;
quit;


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.