Procedure features: |
HBAR statement options:
|
AUTOREF |
|
COUTLINE= |
|
CLIPREF |
|
SUBGROUP= | |
HBAR3D
statement options:
|
FREQ |
|
FREQLABEL= |
|
MIDPOINTS= | |
|
Other features: |
GOPTIONS statement option:
|
AXIS statement |
LEGEND
statement |
RUN-group processing |
|
Sample library
member: |
GCHBRMID
|
This example
uses the FITNESS data set to produce a
horizontal bar chart that shows the number of people in each age group in
a fitness program.
It charts the numeric variable AGE with the frequency
statistic. Because the values of AGE are continuous, the procedure automatically
divides the ages into ranges and displays the midpoint of each age range.
The frequency statistic calculates the number of observations in each range.
The chart statistic defaults to FREQ because the SUMVAR= and TYPE= options
are omitted. The table of statistics displays all the statistic values.
The second part of this example modifies the midpoint
axis and the table of statistics, and uses RUN-group processing to produce
the following chart. This part of the program specifies the midpoint value
for each bar and requests only the FREQ statistic for the
table.
|
goptions reset=all border; |
|
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
29 M 54 3 44.8
48 F 66 2 28.9
36 F 66 2 33.2
; |
|
title1 "Fitness Program Participants";
footnote j=r "GCHBRMID(a)"; |
|
axis1 label=("Number of People")
minor=(number=1)
offset=(0,0); |
|
legend1 label=none
value=("Women" "Men"); |
|
wref=(5 5);
lref=(2 1); |
|
proc gchart data=fitness;
hbar age / subgroup=sex legend=legend1 autoref
clipref
raxis=axis1;
run; |
|
axis1 order=(0 to 4 by 1)
label=("Number of People")
minor=(number=1)
offset=(0,0); |
|
footnote j=r "GCHBRMID(b)"; |
|
axis2 label=("Age " j=r "Group"); |
|
hbar3d age / midpoints=(30 40 50)
freq freqlabel="Total in Group" subgroup=sex autoref
maxis=axis2
raxis=axis1
legend=legend1
coutline=black
;
run;
quit; |
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.