SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Enhancing and Exporting Charts and Plots
Controlling VBAR Statistics


Next, let's consider vertical bar charts. By default, only the statistic frequency is displayed for VBAR charts (and VBAR3D charts, which are three-dimensional vertical bar charts). To display additional statistics, you can use
  • the OUTSIDE= option to display a statistic above the bars
  • the INSIDE= option to display a statistic within the bars.

General form, VBAR and VBAR3D statements for specifying additional statistics:
VBAR | VBAR3D chart-variable / <options>
                               OUTSIDE=statistic
                               INSIDE=statistic;

where statistic indicates the statistic of the chart variable to be displayed.

NOTE: You may specify any valid VBAR statistic for the OUTSIDE= and INSIDE= options, and you may use these options separately or together. In some cases, the statistic may be wider than the bars and so may not display properly.


This example shows a VBAR statement which specifies that the statistic FREQ (frequency) be displayed inside the bars and the statistic CFREQ (cumulative frequency) be displayed above the bars.
        proc gchart data=clinic.admit;
           vbar sex / group=actlevel
                patternid=group outside=cfreq
                inside=freq;
        run;

Example of specifying VBAR statistics.

In contrast, the chart below shows the default behavior for VBAR charts. Note that unlike horizontal bar charts, by default only one statistic is displayed.
        proc gchart data=clinic.admit;
           vbar sex / group=actlevel
                patternid=group;
        run;

Default statistics for VBAR charts.

Note:

As with horizontal bar charts, you can label statistics on vertical bar charts. For example, the program below replaces the text for the statistic on the response (y) axis with the label specified in the AXIS statement.

     axis1 label=('No. of People');
     proc gchart data=clinic.admit;
        hbar sex / group=actlevel patternid=group
             outside=cfreq inside=freq raxis=axis1;
     run;

VBAR chart

 

For more information, see SAS/GRAPH Software: Reference.


  back||next

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

Terms of Use & Legal Information | Privacy Statement