Sample 24872: Produce one standard error with the ERRORBAR= option in PROC GCHART
This sample uses the ERRORBAR= option to produce one standard error.
/* Set graphics options */
goptions reset=all gunit=pct border ftext=swissb htext=3
htitle=6 ctext=black colors=(black) lfactor=2;
/* Create input data set, SOLD */
data sold;
input age 1-2 rate 4-6;
datalines;
50 60
50 88
50 75
51 74
51 90
51 67
52 55
52 76
52 78
54 63
54 65
54 76
55 82
55 75
55 78
56 87
56 89
56 71
60 60
60 87
60 69
;
run;
/* Define patterns for the bars */
pattern1 value=solid c=cyan;
/* Add the title */
title1 'Heart Rates';
/* The ERRORBAR= option draws confidence intervals on a horizontal */
/* or vertical bar chart for either: The mean of the SUMVAR= variable */
/* for each midpoint if you specify TYPE=MEAN. The percentage of */
/* observations assigned to each midpoint if you specify TYPE=PCT */
/* with no SUMVAR= option. ERRORBAR=BOTH draws error bars as two */
/* ticks joined by a line. The default value for the CLM= option is */
/* 95%. By default, CLM= draws the intervals using ERRORBAR=BOTH. */
/* If you want the error bars to represent a given number C of standard */
/* errors instead of a confidence interval, and if the number of */
/* observations assigned to each midpoint is the same, then you can */
/* find the appropriate value for the CLM= option by running a DATA */
/* step. */
data _null_; /* If you want error bars that */
c=1; /* represent one standard */
n=3; /* error (C=1) with a sample */
level=100 * (1 - 2 * (1 - PROBT(C,N-1))); /* size on N, you can compute */
call symput('level', put(level,best12.)); /* the appropriate value for */
run; /* CLM= option and assign that */
/* value to a macro variable &LEVEL */
/* Produce the chart */
proc gchart data=sold;
hbar age / type =mean sumvar=rate discrete frame
errorbar=both clm=&level cerror=red;
run;
quit;

This sample illustrates how to generate a bar chart with one standard error using the ERRORBAR= option in PROC GCHART.
| Type: | Sample |
| Topic: | SAS Reference ==> Procedures ==> GCHART Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Elements ==> Statistical Graph Enhancements
|
| Date Modified: | 2005-08-24 16:06:26 |
| Date Created: | 2004-11-11 11:07:53 |
Operating System and Release Information
| SAS System | SAS/GRAPH | All | n/a | n/a |