Sample 24877: Format percentage values on a pie chart with PROC GCHART
The sample code on the Full Code tab uses PROC GCHART to format percentage values on a pie chart with no decimal places.
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 uses PROC GCHART to format percentage values on a pie chart with no decimal places.
The graphics output in the Results tab was produced using SASĀ® 9.2. Submitting
the sample code with releases of SAS prior to SAS 9.2 might produce different results.
/* Set the graphics environment */
goptions reset=all cback=white border htitle=12pt htext=10pt;
/* Create the input data set SALES */
data sales;
input Site $ 1-8 Salescnt;
datalines;
Atlanta 103
Chicago 486
Dallas 195
Denver 400
New York 307
Seattle 577
;
run;
/* Create an output data set, SALESPCT using PROC FREQ. */
/* Determine the PERCENT of sales for each site based on */
/* SALESCNT. */
proc freq data=sales;
tables site/out=salespct;
weight salescnt;
run;
/* Create a format for the values of PERCENT. The PCTFMT. */
/* format rounds the percentage to no decimal places and */
/* adds a percent sign to the value. */
proc format;
picture pctfmt (round) 0-high='000%';
run;
/* Add a title to the graph */
title1 'Sales Percentages';
/* Produce the chart */
proc gchart data=salespct;
pie site / sumvar=percent noheading;
/* The FORMAT statement applies the PCTFMT. */
/* to the values of PERCENT. */
format percent pctfmt.;
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.
This sample uses PROC GCHART to format percentage values on a pie chart with no decimal places.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> GCHART Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Types ==> Charts ==> Pie
|
Date Modified: | 2005-08-24 16:06:27 |
Date Created: | 2004-11-11 11:07:54 |
Operating System and Release Information
SAS System | SAS/GRAPH | All | n/a | n/a |