Chapter Contents

Previous

Next
The GCHART Procedure

Example 12: Grouping and Arranging Pie Charts


Procedure features:
PIE statement options:
ACROSS=
CLOCKWISE
GROUP=
OTHER=
PERCENT=OUTSIDE
SLICE=OUTSIDE
Other features: PATTERN statement
Data set: ENPROD
Sample library member: GR13N12

[IMAGE]

This example produces two pie charts that shows energy sources by year. Both charts are displayed on one page and are arranged two across. The program uses the CLOCKWISE option to arrange the slices, which begin at the 12 o'clock position and proceed clockwise in alphabetic order of the midpoint.

The chart statistic is suppressed and the midpoint label and the percent of the chart statistic are displayed outside of the slice.

A different color is defined for each energy type. The patterns are assigned in order of midpoint value. Some colors do not appear because the slices they represent are grouped into the OTHER slice, which is assigned the eighth color, red.
 Note about code
goptions reset=global gunit=pct border cback=white
         colors=(black blue green red) ftext=swiss
         ftext=swissb htitle=5 htext=3.5;
 Note about code
title 'Changes in Energy Production:1985 to 1995';
footnote j=r 'GR13N12 ';
 Note about code
pattern1 color=black;       /* biofuels     */
pattern2 color=blue;        /* coal         */
pattern3 color=green;       /* gas          */
pattern4 color=gray;        /* geothermal   */
pattern5 color=lipk;        /* hydroelectric */
pattern6 color=lime;        /* nuclear      */
pattern7 color=cyan;        /* petro        */
pattern8 color=red;         /* other        */
 Note about code
proc gchart data=reflib.enprod gout=reflib.excat;
     label year='00'x;
 Note about code
     pie engytype / sumvar=produced
                    group=year
                    across=2
                    other=5
                    otherlabel='Renewable'
                    clockwise
                    value=none
                    slice=outside
                    percent=outside
                    coutline=black
                    noheading;
run;
quit;


Chapter Contents

Previous

Next

Top of Page

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