TOPIC: MAXIS
WARNING: No bars were drawn. This could have been caused by ORDER= on the AXIS statement. You might wish to use the MIDPOINTS= option on the VBAR statement instead.
25th September 2015What you see above is an error issued by a SAS program, akin to what a colleague at work recently found. The following code will reproduce this, so let us walk through the steps to explain a possible cause for this.
The first stage is to create a test dataset containing variables y and x, for the vertical and midpoint axes, respectively, and populating these using a CARDS statement in a data step:
data a;
input y x;
cards;
1 5
3 9
;
run;
Now, we define an axis with tick marks for particular values that will be used as the definition for the midpoint or horizontal axis of the chart:
axis1 order=(1 3);
Then, we try creating the chart using the GCHART
procedure that comes with SAS/GRAPH
and this is what results in the error message being issued in the program log:
proc gchart data=a;
vbar x / freq=y maxis=axis1;
run;
quit;
The cause is that the midpoint axis tick marks are not included in the data, so changing these to the actual values of the x variable removes the message and allows the creation of the required chart. Thus, the AXIS1
statement needs to become the following:
axis1 order=(5 9);
Another solution is to remove the MAXIS
option from the VBAR
statement and let GCHART
to be data-driven. However, if requirements do not allow this, create a shell dataset with all expected values for the midpoint axis with y set 0 since that is used for presenting frequencies as per the FREQ option in the VBAR
statement.