Data visualization with SAS programming

Incremental value in SGPLOT/XAXIS

Reply
Contributor
Posts: 35

Incremental value in SGPLOT/XAXIS

Hi, there:

I am a simple (probably silly) question on the sgplot outcome. The graph I try to generate is a figure with both bars and lines (similar to the charts used in stock markets, where lines are for prices but bars for volumes).I don't want the figure to be too busy, so I try to control the incremental value for horizontal axis by using the xaxis statement.

I wrote

xaxis label="Trading Interval (Quarters)"  values=(0 to 150 by 20) offsetmin=0 offsetmax=0;

I suppose numbers showing on the axaxis should be 0, 20, 40 ect. Howerver, the outcome is that the numbers are 1, 2, 3, ..., i.e, the incremental value is 1 rather than 20. There is no warning or error message from SAS. I am using SAS9.2 in a UNIX system. Is there something wrong?

Thanks.

SAS Super FREQ
Posts: 925

Incremental value in SGPLOT/XAXIS

The bar chart forces the xaxis to be discrete, so the VALUES option has no effect in that case. The best two options for you in this chart is to either set the TICKVALUEFITPOLICY=THIN on the XAXIS statement or use a NEEDLE plot and SERIES plot overlay instead of the VBAR/VLINE overlay. In the NEEDLE/SERIES case, the VALUES option will be honored because the axis is continuous by default.

Hope this helps!

Dan

Contributor
Posts: 35

Incremental value in SGPLOT/XAXIS

Dear Dan:

Thanks.

I will try what you suggested.

Contributor
Posts: 35

Incremental value in SGPLOT/XAXIS

Hi, Dan:

A follow up question: is there ways to only specify the incremental value without specifying the boundaries?

SAS Super FREQ
Posts: 925

Incremental value in SGPLOT/XAXIS

Not currently, but can still work around that. Specify start and end values in the VALUES option that go beyond the typical limits of your data and specify the VALUESHINT option. The boolean option tells the proc to display tick values from the VALUES option only if they fall within the range of your data. All specified values outside of the data range are ignored. Be sure that the range specified by your start and end values are evenly divisible by your increment value for best results.

Contributor
Posts: 35

Incremental value in SGPLOT/XAXIS

Dan: That is great! Thanks.

Ask a Question
Discussion stats
  • 5 replies
  • 312 views
  • 1 like
  • 2 in conversation