Creating a Bar Chart for a Continuous Variable (System-Chosen Midpoints) - SAS Programming

In the examples in this chapter thus far,you have been displaying frequencies, or percentages, of observations with discrete values of a character variable, namely REGION.You can also use continuous numeric variables with the VBAR and HBAR statements.If you want to see the frequency distribution of the variable PRICE, for example, you write:

Example

PROC CHART DATA=SALES;
TITLE 'Vertical Bar Chart for a Continuous Variable';
VBAR PRICE;
RUN;

When you use PROC CHART to produce frequencies or percentages for a continuous numeric variable, the procedure creates sub-ranges of values of the variable to use for grouping purposes.You can either let the system decide on the ranges to use,or you can make the decision. In this example, you let the system do the choosing and it automatically selects the ranges of PRICE to be placed on the X axis. The Y axis then represents the number of observations that fit into the selected ranges.

Since PROC CHART can produce both vertical and horizontal charts, the terms "X axis" and "Y axis" may be confusing.SAS Institute publications often refer to the axis representing the height or length of the bars as the "response axis." The explanations here will continue to use X axis and Y axis for vertical charts (there are no more HBAR outputs so it should not be confusing.)The previous code produces the following chart:

Output from Example - Creating a Bar Chart for a Continuous Variable (System-Chosen Midpoints)

Output from Example - Creating a Bar Chart for a Continuous Variable (System-Chosen Midpoints)

The values on the X axis represent the midpoints of the intervals. For example, the barlabeled 9 represents all observations with amounts between 8 and 10.in actuality, the amounts are greater than 8 and less than 10.That is why the observations with values of 10 fall in the 11 category (GE 10 and LT 12.)


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

SAS Programming Topics