The sample code on the Full Code tab uses the GROUP= option in the PIE statement of PROC GCHART to display multiple pie charts on a page. It also uses the ACROSS= option to define how the pie charts are arranged on the page.
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
This sample code uses the GROUP= option in the PIE statement of PROC GCHART to display multiple pie charts on a page. It also uses the ACROSS= option to define how the pie charts are arranged on the page.
The graphics output in the Results tab was produced using SAS® 9.2. Submitting the sample code with other releases of SAS might produce different results.
/* Set the graphics environment */
goptions reset=all border cback=white htitle=12pt;
/* Create the data set ENPROD */
data enprod;
length engytype $ 8;
input year engytype produced;
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
;
run;
/* Define the title */
title 'Changes in Energy Production:1985 to 1995';
/* Assign a color to each energy type */
pattern1 V=S c=vibg; /* biofuels */
pattern2 v=s c=dabg; /* coal */
pattern3 v=s c=mob; /* gas */
pattern4 v=s c=day; /* geothermal */
pattern5 v=s c=deoy; /* hydoelectric */
pattern6 v=s c=grp; /* nuclear */
pattern7 v=s c=gray; /* petro */
pattern8 v=s c=beige; /* other */
/* Generate the pie chart */
proc gchart data=enprod;
pie engytype / sumvar=produced
other=5
otherlabel='Renewable'
group=year
across=2
clockwise
value=none
slice=outside
percent=outside
coutline=black
noheading;
run;
quit;
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> GCHART Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Types ==> Charts ==> Pie |
Date Modified: | 2005-08-24 16:06:36 |
Date Created: | 2005-05-23 14:12:55 |
Product Family | Product | Host | SAS Release | |
Starting | Ending | |||
SAS System | SAS/GRAPH | z/OS | 9.1 TS1M0 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.1 TS1M0 | |||
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.1 TS1M0 | |||
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.1 TS1M0 | |||
Microsoft Windows 2000 Advanced Server | 9.1 TS1M0 | |||
Microsoft Windows 2000 Datacenter Server | 9.1 TS1M0 | |||
Microsoft Windows 2000 Server | 9.1 TS1M0 | |||
Microsoft Windows 2000 Professional | 9.1 TS1M0 | |||
Microsoft Windows NT Workstation | 9.1 TS1M0 | |||
Microsoft Windows Server 2003 Datacenter Edition | 9.1 TS1M0 | |||
Microsoft Windows Server 2003 Enterprise Edition | 9.1 TS1M0 | |||
Microsoft Windows Server 2003 Standard Edition | 9.1 TS1M0 | |||
Microsoft Windows XP Professional | 9.1 TS1M0 | |||
64-bit Enabled AIX | 9.1 TS1M0 | |||
64-bit Enabled HP-UX | 9.1 TS1M0 | |||
64-bit Enabled Solaris | 9.1 TS1M0 | |||
HP-UX IPF | 9.1 TS1M0 | |||
Linux | 9.1 TS1M0 | |||
OpenVMS Alpha | 9.1 TS1M0 | |||
Tru64 UNIX | 9.1 TS1M0 |