SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Enhancing and Exporting Charts and Plots
Controlling HBAR Statistics


In addition to adding titles, footnotes, formats, and labels to your SAS/GRAPH output, you can enhance specific types of graphs. In the lesson Creating Bar and Pie Charts, you saw that you can control which statistics are displayed to the right of a horizontal bar chart. You can also assign descriptive labels to the statistics in the HBAR statement (or HBAR3D statement, for three-dimensional charts) so your graphics will be easier to interpret.


General form, HBAR and HBAR3D statements:
HBAR | HBAR3D chart-variable / <options>
                                statistic

                                statistic-label='label-text';

where

  • statistic specifies which statistic or statistics are displayed to the right of the bars.

  • statistic-label= invokes the HBAR statistic column label option and assigns a label to the statistic. Allowable statistic options are FREQLABEL=, CFREQLABEL=, PERCENTLABEL=, CPERCENTLABEL=, SUMLABEL=, and MEANLABEL=.

  • 'label-text' specifies the text that will be used for the label. You may use single or double quotation marks. Labels are limited to 32 characters.
NOTE: You may use multiple column labels for one graph.


For example, the HBAR statement in the PROC GCHART step below specifies that only the statistic FREQ (frequency) be displayed. It also specifies that the FREQ label be replaced with the more descriptive wording No. of People. Notice that the label is automatically wrapped to conserve space.
        proc gchart data=clinic.admit;
           hbar sex / group=actlevel
                patternid=group freq
                freqlabel='No. of People';
        run;

Example of specifying and labeling HBAR statistics.

In contrast, the example below shows the default statistics and labels for a horizontal bar chart.
        proc gchart data=clinic.admit;
           hbar sex / group=actlevel
                patternid=group;
        run;

Default statistics for HBAR charts.


  back||next

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

Terms of Use & Legal Information | Privacy Statement