Sample 24877: Format percentage values on a pie chart
/* Set graphics options */
goptions reset=global htext=4 pct ftext=swiss border;
/* Create 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
;
/* 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;
/* Produce the chart */
proc gchart data=salespct;
/* Add title */
title1 h=5 pct 'Sales Percentages';
pie site / sumvar=percent noheading;
/* The FORMAT statement applies the PCTFMT. */
/* to the values of PERCENT. */
format percent pctfmt.;
/* Define patterns for the pie chart */
pattern1 v=s c=blue;
pattern2 v=s c=cyan;
pattern3 v=s c=green;
pattern4 v=s c=magenta;
pattern5 v=s c=red;
pattern6 v=s c=yellow;
run;
quit;

Formatting percentage values 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 |