Data visualization with SAS programming

Specify y axis max in SGPLOT

Posts: 30

Specify y axis max in SGPLOT

I'm using an macro in SGPLOT to create graphs (code attached) and I want to specify the minimum and maximum values of the y axis.

Data for the graphs comes from the data set macrovar, which includes the variables Ymin, Ymax, and Yint.

When the graphs are created, they have the interval that I have specified with Yint, but the maximum value for the Yaxis is not what I have specified with the Ymax variable.

In the attached example graph, the maximum is just a little bit above 85.  However, I have specified that the max for the Y axis needs to be 93.5.  Why is it not using the values I have specified for Ymax?  Any help figuring this out would be greatly appreciated!


graph example.JPG

Super Contributor
Posts: 273

Re: Specify y axis max in SGPLOT


Hypothesis to verify!

1)Was there an interaction between your title defined with a title area  with move(14,-10) ?

2)what happens if you change into  ods graphics /height=20 cm;

3) an effect of offsets ?


Posts: 1,263

Re: Specify y axis max in SGPLOT

I believe you are using the right (VALUES) option.  You could additionally try the MIN and MAX options on the Y axis.  Hard to say without the data and with the macro variables.

Posts: 1,042

Re: Specify y axis max in SGPLOT

If you add the VALUESHINT option, I believe you will get what you want. By default, the axis will be constrained by the min/max values in the VALUES option. However, if you also specify VALUESHINT, the axis will not be constrained, and the tick values from the VALUES option that fall within the axis range will be drawn.

Hope this helps!


Ask a Question
Discussion stats
  • 3 replies
  • 4 in conversation