Sample 25517: Error bars in a horizontal bar chart using PROC GCHART
This sample is from the "SAS/GRAPH Software: Reference, Version 8", Volume 1, Chapter 13.
For additional information on the sample refer to this book.
/*+------------------------------------------------------+
| S A S S A M P L E L I B R A R Y |
| |
| NAME: GCHERRBR |
| TITLE: GCHERRBR-Error Bars in a Horiz Bar Chart |
| PRODUCT: GRAPH |
| SYSTEM: ALL |
| KEYS: GRAPHICS GCHART AXIS PATTERN |
| PROCS: GCHART |
| DATA: INTERNAL |
| |
| SUPPORT: GRAPHICS STAFF UPDATE: |
| REF: SAS/GRAPH REFERENCE GUIDE |
+------------------------------------------------------+*/
goptions reset=all gunit=pct border cback=white
colors=(black blue green red) ftitle=swissb
ftext=swiss htitle=5 htext=3.5;
/* 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
;
/* Define title */
title1 'Average Resting Heart Rate by Age';
footnote h=3 j=r 'GCHERRBR ';
/* Modify axes */
axis1 label=('Heart Rate' j=c
'Error Bar Confidence Limits: 95%')
minor=(number=1);
axis2 label=('Age' j=r 'Group');
/* Define pattern characteristics */
pattern1 color=cyan;
/* 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;

This example 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 |