Creating a Bar Chart for a Continuous Variable (without DISCRETE Option) - SAS Programming

you used the MIDPOINTS= option to specify intervals for a continuous numeric variable. you use the DISCRETE option to specify meaningful intervals, but first you write the code here without using DISCRETE,for comparison.Suppose you want frequencies on a numeric variable DAY in a data set called OSCAR where the values 1 to 7 represent the days of the week (l=Sun, 2=Mon, etc.).You can simply write:

Example

PROC CHART DATA=OSCAR;
TITLE 'Vertical Chart without DISCRETE Option';
VBAR DAY;
HUN;

This code yields the following strange-looking output:

Output from Example - Creating a Bar Chart for a Continuous Variable (without DISCRETE Option)

Output from Example - Creating a Bar Chart for a Continuous Variable (without DISCRETE Option)

The SAS System,unable to read your mind,found reasonable intervals for the numeric variable DAY and represented each interval with a midpoint. How was the system to know that the numeric values supplied in the data set already represented meaningful categories?


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

SAS Programming Topics