Creating a Bar Chart for a Continuous Variable (User-Chosen Midpoints by Range) - SAS Programming

If you would like to select your own X axis intervals, you have two options which are discussed in this example and the next one. You can use the MIDPOINTS= option of VBAR or HBAR to specify your own midpoints.Starting with the previous code, to select midpoints ranging from 8 to 20 that are incremented by a value of 4, you write:

Example

PROC CHART DATA=SALES;
TITLE 'Vertical Bar Chart Demonstrating MIDPOINTS Option';
VBAR PRICE / MIDPOINTS=8 to 20 by 4;
RUN;

Here is the output produced:

Output from Example - Creating a Bar Chart for a Continuous (User-Chosen Midpointsby Range)

Output from Example - Creating a Bar Chart for a Continuous (User-Chosen Midpointsby Range)

There are still three bars owing to the particular makeup of the data and the midpoints chosen, but the midpoints and accompanying ranges are now as you chose them, and not as the system decided.You can specify midpoints several ways.The most common method, which is used in this example, is:

MIDPOINTS = lower_bound TO upper_bound BY interval;

You can also provide a list of specific midpoints without equal intervals like this:

VBAR PRICE / MIDPOINTS=0, 5, 10, 20; Or even like this:
VBAR PRICE / MIDPOINTS=0, 10, 100, 1000, 10000, 100000;

The third method produces an X axis with intervals based on a log 10 scale


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

SAS Programming Topics