Sample 25517: Error bars in a horizontal bar chart using PROC GCHART
This sample produces error bars on a horizontal bar chart using the ERRORBAR= option in the HBAR statement of PROC GCHART.
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 produces error bars on a horizontal bar chart using the ERRORBAR= option in the HBAR statement of PROC GCHART.
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.
/* Create the FITNESS data set */
data fitness;
input age sex $ heart exer aero;
datalines;
28 M 86 2 36.6
41 M 76 3 26.7
30 M 78 2 33.8
39 F 90 1 13.6
28 M 96 1 33.
26 M 74 2 42.7
. F 66 4 36.1
48 F 72 2 22.6
31 M 60 3 44.1
28 F 84 2 22.1
33 F 56 4 21.3
37 F 78 2 30.3
46 M 84 1 34.2
23 M 72 2 38.1
25 F 88 1 32.0
37 F 72 2 43.7
42 M 60 3 36.7
44 F 78 3 21.6
. F 70 1 22.8
25 F 60 3 36.1
24 F 74 2 29.9
29 F 66 4 38.9
27 M 62 4 44.0
24 M 72 3 44.2
36 F 80 1 26.2
24 M 82 2 18.7
23 M 54 3 70.6
28 F 76 1 23.8
30 F 66 2 28.9
25 M 54 3 41.3
48 F 72 2 28.9
23 F 68 1 18.9
22 F 78 2 39.0
23 F 66 3 36.1
46 F 54 3 28.9
31 F 84 1 21.6
45 M 60 2 47.8
27 M 90 2 43.1
26 M 66 2 28.9
26 F 84 2 .
24 M 72 3 50.1
32 F 72 1 15.7
29 M 54 3 44.8
48 F 66 2 28.9
36 F 66 2 33.2
;
run;
/* Define title */
title1 h=12pt 'Average Resting Heart Rate by Age';
/* Modify axes */
axis1 label=('Heart Rate' j=c
'Error Bar Confidence Limits: 95%')
minor=(number=1);
axis2 label=('Age' j=r 'Group');
goptions border;
/* Produce horizontal bar chart */
proc gchart data=fitness;
hbar age / type=mean
freqlabel='Number in Group'
meanlabel='Mean Heart Rate'
sumvar=heart
errorbar=bars
noframe
clm=95
midpoints=(20 30 40 50)
raxis=axis1
maxis=axis2
coutline=black;
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 produces error bars on a horizontal bar chart using the ERRORBAR= option.
| Type: | Sample |
| Topic: | Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Types ==> Charts ==> Bar SAS Reference ==> Procedures ==> GCHART
|
| Date Modified: | 2005-08-24 16:06:36 |
| Date Created: | 2005-05-23 14:12:43 |
Operating System and Release Information
| SAS System | SAS/GRAPH | All | 8 TS M0 | n/a |