Sample 25518: Ordering and labeling Pie Chart slices using PROC GCHART
This example labels pie chart slices in the order in which they are specified by the MIDPOINTS= option on the PIE statement. Options are also specified to control where the pie values are displayed.
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: GCHLABEL |
| TITLE: GCHLABEL-Ordering/Labeling Pie-Chart Slices |
| 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=(black blue green red cyan lime gray)
ftitle=swissb ftext=swiss htitle=6 htext=4;
/* Create data set ENPROD */
data enprod;
input @1 year 4. @6 engytype $8. @16 produced 5.2;
datalines;
1985 Coal 19.33
1985 Gas 19.22
1985 Petro 18.99
1985 Nuclear 4.15
1985 Hydro 2.97
1985 Geotherm .20
1985 Biofuels .01
1995 Coal 21.98
1995 Gas 21.54
1995 Petro 13.89
1995 Nuclear 7.18
1995 Hydro 3.21
1995 Geotherm .31
1995 Biofuels 2.95
;
/* Define title and footnote for chart */
title 'Sources of Energy, 1995';
footnote h=3 j=r 'GCHLABEL ';
/* Generate pie chart */
proc gchart data=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;

This example labels pie chart slices in the order they are specified by the MIDPOINTS= option on the PIE statement. Options are also specified to control where the pie values are displayed.
| Type: | Sample |
| Topic: | Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Types ==> Charts ==> Pie Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Elements ==> Labels SAS Reference ==> Procedures ==> GCHART
|
| Date Modified: | 2005-08-24 16:06:36 |
| Date Created: | 2005-05-23 14:12:47 |
Operating System and Release Information
| SAS System | SAS/GRAPH | All | 8 TS M0 | n/a |