The sample code on the Full Code tab uses the ERRORBAR= option to produce error bars on a horizontal bar chart generated with 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 other releases of SAS 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 the title */
title1 h=12pt 'Average Resting Heart Rate by Age';
/* Modify the axes */
axis1 label=('Heart Rate' j=c
'Error Bar Confidence Limits: 95%')
minor=(number=1);
axis2 label=('Age' j=r 'Group');
goptions border;
/* Produce the 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.
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 |
Product Family | Product | Host | SAS Release | |
Starting | Ending | |||
SAS System | SAS/GRAPH | z/OS | 9.1 TS1M0 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.1 TS1M0 | |||
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.1 TS1M0 | |||
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.1 TS1M0 | |||
Microsoft Windows 2000 Advanced Server | 9.1 TS1M0 | |||
Microsoft Windows 2000 Datacenter Server | 9.1 TS1M0 | |||
Microsoft Windows 2000 Server | 9.1 TS1M0 | |||
Microsoft Windows 2000 Professional | 9.1 TS1M0 | |||
Microsoft Windows NT Workstation | 9.1 TS1M0 | |||
Microsoft Windows Server 2003 Datacenter Edition | 9.1 TS1M0 | |||
Microsoft Windows Server 2003 Enterprise Edition | 9.1 TS1M0 | |||
Microsoft Windows Server 2003 Standard Edition | 9.1 TS1M0 | |||
Microsoft Windows XP Professional | 9.1 TS1M0 | |||
64-bit Enabled AIX | 9.1 TS1M0 | |||
64-bit Enabled HP-UX | 9.1 TS1M0 | |||
64-bit Enabled Solaris | 9.1 TS1M0 | |||
HP-UX IPF | 9.1 TS1M0 | |||
Linux | 9.1 TS1M0 | |||
OpenVMS Alpha | 9.1 TS1M0 | |||
Tru64 UNIX | 9.1 TS1M0 |