Chapter Contents |
Previous |
Next |
The GCHART Procedure |
Procedure features: |
| ||||||||||||||||
Other features: |
| ||||||||||||||||
Sample library member: | GR13N05 |
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 program also subgroups each age group bar to show the number of men and women in the group. Because the default value for the PATTERNID= option is SUBGROUP, the procedure automatically assigns a different pattern to each subgroup and the PATTERNID= option is unnecessary.
PATTERN statements specify the colors for the subgroups. Whenever the GCHART procedure uses PATTERN statements, the default outline color of the bars changes from black to the color of the bar. Because this program uses PATTERN statements, it also uses COUTLINE= to specify a black outline for the bars.
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.
libname reflib 'SAS-data-library'; goptions reset=global gunit=pct border cback=white colors=(black blue green red) ftext=swiss ftitle=swissb htitle=6 htext=3.5; |
data reflib.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 ...more data lines... 29 M 54 3 44.8 48 F 66 2 28.9 36 F 66 2 33.2 ; |
title1 'Fitness Program Participants'; footnote h=3 j=r 'GR13N05(a) '; |
axis1 label=('Number of People') minor=(number=1) offset=(0,0); |
legend1 label=none value=('Women' 'Men'); |
pattern1 color=cyan; pattern2 color=blue; |
proc gchart data=reflib.fitness; hbar age / subgroup=sex legend=legend1 autoref clipref coutline=black raxis=axis1; run; |
footnote h=3 j=r 'GR13N05(b) '; |
axis1 order=(0 to 20 by 2) label=('Number of People') minor=(number=1) offset=(0,0); |
axis2 label=('Age ' j=r 'Group'); |
hbar3d age / midpoints=(20 30 40 50) freq freqlabel='Total in Group' subgroup=sex autoref maxis=axis2 raxis=axis1 legend=legend1 coutline=black; run; quit; |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.