CHART Procedure

Example 1: Producing a Simple Frequency Count

Features:

VBAR statement

Details

This example produces a vertical bar chart that shows a frequency count for the values of the chart variable.

Program

data shirts;
   input Size $ @@;
   datalines;
medium    large
large     large
large     medium
medium    small
small     medium
medium    large
small     medium
large     large
large     small
medium    medium
medium    medium
medium    large
small     small
;
proc chart data=shirts;
   vbar size;
   title 'Number of Each Shirt Size Sold';
run;

Program Description

Create the SHIRTS data set. SHIRTS contains the sizes of a particular shirt that is sold during a week at a clothing store, with one observation for each shirt that is sold.
data shirts;
   input Size $ @@;
   datalines;
medium    large
large     large
large     medium
medium    small
small     medium
medium    large
small     medium
large     large
large     small
medium    medium
medium    medium
medium    large
small     small
;
Create a vertical bar chart with frequency counts. The VBAR statement produces a vertical bar chart for the frequency counts of the Size values.
proc chart data=shirts;
   vbar size;
Specify the title.
   title 'Number of Each Shirt Size Sold';
run;

Output: HTML

The following frequency chart shows the store's sales of each shirt size for the week: 9 large shirts, 11 medium shirts, and 6 small shirts.
Number of Each Shirt Size Sold