SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Creating Bar and Pie Charts
Summarizing a Variable within Categories


You've seen how to use the TYPE= and SUMVAR= options individually. You can also combine the SUMVAR= option with TYPE=MEAN to request the average of the values of the summary variable for each unique value of the chart variable.

NOTE: To use TYPE= MEAN, you must also use the SUMVAR= option.


Example

This GCHART step specifies a chart variable (Company) and an analysis variable (BalanceDue) as before, but also uses TYPE=MEAN to request the statistic MEAN. The chart below represents the average balance due for each company.

     proc gchart data=clinic.insure;
        vbar company / sumvar=balancedue type=mean;
     run;

Vertical bar chart w/analysis variable and TYPE=MEAN option.

The GCHART step below is the same as the example above, except that it specifies a pie chart rather than a vertical bar chart.
     proc gchart data=clinic.insure;
        pie company / sumvar=balancedue type=mean;
     run;

Pie chart w/analysis variable and TYPE=MEAN option.

The pie slices still represent the average of each company's balance due amounts. But unlike the vertical bar chart, not every company appears in the pie chart. The companies Employers and Mutuality do not appear because they have no balance due. The companies A&R, Essential, and Parnassus do not appear individually because they have been automatically combined in the category OTHER.

As shown below, messages in the Log window describe the OTHER slice.

SAS Log
NOTE: The A&R midpoint was included into the OTHER
      slice with a value of 9.48 representing
      0.8 percent of the pie/donut.
NOTE: The ESSENTIAL midpoint was included into the
      OTHER slice with a value of 26.21
      representing 2.2 percent of the pie/donut.
NOTE: The PARNASSUS midpoint was included into the
      OTHER slice with a value of 43.68
      representing 3.7 percent of the pie/donut.


NOTE: Companies that do not appear in the pie chart are still assigned, in turn, a color from the color list


back||next


Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.

Terms of Use & Legal Information | Privacy Statement