Sample 25522: Subgrouping a donut or pie chart using PROC GCHART
This sample is from the "SAS/GRAPH Software: Reference, Version 8", Volume 1, Chapter 13.
For additional information on the sample refer to this book.
/*+-------------------------------------------------------+
| S A S S A M P L E L I B R A R Y |
| |
| NAME: GCHSBGRP |
| TITLE: GCHSBGRP-Subgrouping a Donut or Pie Chart |
| PRODUCT: GRAPH |
| SYSTEM: ALL |
| KEYS: GRAPHICS GCHART |
| PROCS: GCHART |
| DATA: INTERNAL |
| |
| SUPPORT: GRAPHICS STAFF UPDATE: |
| REF: SAS/GRAPH REFERENCE GUIDE |
+-------------------------------------------------------+*/
/* Set the graphics environment */
goptions reset=all gunit=pct border cback=white
colors=(blue green red) ctext=black
ftitle=swissb ftext=swiss htitle=6 htext=2.5;
/* Create data set TOTALS */
data totals;
length Dept $ 7 Site $ 8;
input Dept Site Quarter Sales;
datalines;
Parts Sydney 1 4043.97
Parts Atlanta 1 6225.26
Parts Paris 1 3543.97
Repairs Sydney 1 5592.82
Repairs Atlanta 1 9210.21
Repairs Paris 1 8591.98
Tools Sydney 1 1775.74
Tools Atlanta 1 2424.19
Tools Paris 1 5914.25
Parts Sydney 2 3723.44
Parts Atlanta 2 11595.07
Parts Paris 2 9558.29
Repairs Sydney 2 5505.31
Repairs Atlanta 2 4589.59
Repairs Paris 2 7538.56
Tools Sydney 2 2945.17
Tools Atlanta 2 1903.99
Tools Paris 2 7868.34
Parts Sydney 3 8437.96
Parts Atlanta 3 6847.91
Parts Paris 3 6789.85
Repairs Sydney 3 4426.46
Repairs Atlanta 3 5011.66
Repairs Paris 3 6510.38
Tools Sydney 3 3767.10
Tools Atlanta 3 3048.52
Tools Paris 3 9017.96
Parts Sydney 4 6065.57
Parts Atlanta 4 9388.51
Parts Paris 4 8509.08
Repairs Sydney 4 3012.99
Repairs Atlanta 4 2088.30
Repairs Paris 4 5530.37
Tools Sydney 4 3817.36
Tools Atlanta 4 4354.18
Tools Paris 4 6511.70
;
/* Define title and footnote for chart */
title 'Sales by Site and Department';
footnote h=3 j=r 'GCHSBGRP ';
legend1 label=none
shape=bar(4,4)
position=(middle left)
offset=(5,)
across=1
mode=share;
/* Generate donut chart */
proc gchart data=totals;
donut site / sumvar=sales
subgroup=dept
noheading
donutpct=30
label=('All' justify=center 'Quarters')
legend=legend1
coutline=black
ctext=black;
run;
quit;

This example produces a donut chart where the sites are subgrouped by department, so that each department is represented as a concentric ring with slices.
| Type: | Sample |
| Topic: | Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Types ==> Charts ==> Special Charts Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Types ==> Charts ==> Pie SAS Reference ==> Procedures ==> GCHART
|
| Date Modified: | 2005-08-24 16:06:36 |
| Date Created: | 2005-05-23 14:13:03 |
Operating System and Release Information
| SAS System | SAS/GRAPH | All | 8 TS M0 | n/a |