Previous Page | Next Page

The GCHART Procedure

Example 8: Subgrouping a Donut or Pie Chart


Procedure features:

DONUT statement options:

DONUTPCT=

LABEL=

LEGEND=

NOHEADING

SUBGROUP=

Other features:

GOPTIONS statement option:

BORDER

LEGEND Statement

Sample library member: GCHSBGRP

[GCHSBGRP-Subgrouping of a Donut chart]

This example produces a donut chart that is similar to the pie chart in Specifying the Sum Statistic for a Pie Chart in that each slice represents total sales for a site and each slice is a different color. However, in this donut chart the sites are subgrouped by department, so that each department is represented as a concentric ring with slices.

Subgrouping suppresses the chart statistic and the midpoint labels. Instead it automatically labels the rings with the subgroup values and generates a legend that shows how the patterns are associated with the midpoint values. Subgrouping a pie chart produces the same results but without the hole in the center.

To make the donut chart as large as possible, the program suppresses the default heading and moves the legend into the space at the left of the chart.

 Note about code
data totals;
length dept $ 7 site $ 8;
input dept site quarter sales;
datalines;
Parts Sydney 1 7043.97
Parts Atlanta 1 8225.26
Parts Paris 1 5543.97
Tools Sydney 4 1775.74
Tools Atlanta 4 3424.19
Tools Paris 4 6914.25
;
 Note about code
title "Sales by Site and Department";
footnote j=r "GCHSBGRP ";
 Note about code
legend1 label=none
position=(middle left)
offset=(5,)
across=1; 
 Note about code
proc gchart data=totals;
format sales dollar8.;
donut site / sumvar=sales
subgroup=dept
donutpct=30
label=("All" justify=center "Quarters")
noheading
legend=legend1;
run;
quit; 

Previous Page | Next Page | Top of Page