## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

The following output displays the first 15 observations:
Figure 31.1 Introductory Chemistry Exam Scores
You can create bar charts with this data set to do the following:
Determine a letter grade for each student.
Compare the number of students in each section.
Compare the number of males and females in each section.
Compare the performance of the students in different sections.
Charting Frequencies with the CHART Procedure
Types of Frequency Charts
By default, PROC CHART creates a frequency chart in which each bar, section, or block
in the chart represents a range of values. By default, PROC CHART selects ranges based
on the values of the chart variable. At the center of each range is a midpoint. A midpoint
Charting Frequencies with the CHART Procedure 555
does not always correspond to an actual value of the chart variable. The size of each bar,
block, or section represents the number of observations that fall in that range.
PROC CHART makes several types of charts:
vertical and horizontal bar charts
display the magnitude of data with the length or height of bars.
block charts
display the relative magnitude of data with blocks of varying size.
pie charts
display data as wedge-shaped sections of a circle that represent the relative
contribution of each section to the whole circle.
star charts
display data as bars that radiate from a center point, like spokes in a wheel.
The shape of each type of chart emphasizes a certain aspect of the data. The chart that
you choose depends on the nature of your data and the aspect that you want to
emphasize.
Creating Vertical Bar Charts
Understanding Vertical Bar Charts
A vertical bar chart emphasizes individual ranges. The horizontal, or midpoint, axis
shows the values of the variable divided into ranges. By default, the vertical axis shows
the frequency of values for a given range. The differences in bar heights enable you to
quickly determine which ranges contain many observations and which contain few
observations.
The VBAR statement in a PROC CHART step produces vertical bar charts. If you use
the VBAR statement without any options, then PROC CHART automatically does the
following:
scales the vertical axis
determines the bar width
selects the spacing between bars
labels the axes
For continuous numeric data, PROC CHART determines the number of bars and the
midpoint for each bar from the minimum and maximum value of the chart variable. For
character variables or discrete numeric variables, PROC CHART creates a bar for each
value of the chart variable. However, you can change how PROC CHART determines
the axes by using options.
Note: If the number of characters per line (LINESIZE=) is not sufficient to display
vertical bars, then PROC CHART automatically produces a horizontal bar chart.
The Program
The following program uses the VBAR statement to create a vertical bar chart of
frequencies for the numeric variable ExamGrade1:
options pagesize=40 linesize=80 pageno=1 nodate;
title 'Grades for First Chemistry Exam';
556 Chapter 31 Producing Charts to Summarize Variables
run;
The following output displays the bar chart:
Figure 31.2 Using a Vertical Bar Chart to Show Frequencies
The midpoint axis for the above chart ranges from 40 to 100 and is incremented in
intervals of 10. The following table shows the values and frequency of each bar:
Table 31.1 Values and Frequency
Range Midpoint Frequency
35 to 44 40 3
45 to 54 50 6
Charting Frequencies with the CHART Procedure 557

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required