Chapter Contents

Previous

Next
The GCHART Procedure

Example 8: Specifying the Sum Statistic for a Pie Chart


Procedure features:
PIE statement options:
COUTLINE=
SUMVAR=
PIE3D statement options:
COUTLINE=
EXPLODE=
SUMVAR=
Other features:
FORMAT statement
RUN-group processing
Data set: TOTALS
Sample library member: GR13N08

[IMAGE]

This example produces two pie charts that show total sales for three sites by charting the values of the character variable SITE and calculating the sum of the variable SALES for each site. It represents the statistics as slices of the pie. By default, the midpoint value and the summary statistic are printed beside each slice.

The pie slices use the default pattern fill, which is solid. Because a colors list is specified in the GOPTIONS statement, the default solid patterns rotate through the colors in the list, beginning with the first color, blue. Each slice displays a different color because, by default, pie charts are patterned by midpoint. Because the default outline color is also the first color in the list, the example uses the COUTLINE= option to assign black to the outlines.

The second pie chart is a 3D pie chart with an exploded slice, as shown in the following output.

[IMAGE]

 Note about code
libname reflib 'SAS-data-library';
goptions reset=global gunit=pct border cback=white
         colors=(blue green red) ctext=black
         ftitle=swissb ftext=swiss htitle=6 htext=4;
 Note about code
title 'Total Sales';
footnote j=r 'GR13N08(a) ';
 Note about code
proc gchart data=reflib.totals;
   format sales dollar8.;
   pie site / sumvar=sales
              coutline=black;
run;
 Note about code
   footnote j=r 'GR13N08(b) ';
 Note about code
   pie3d site / sumvar=sales
                coutline=black
                explode='Paris';
run;
quit;


Chapter Contents

Previous

Next

Top of Page

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