BookmarkSubscribeRSS Feed
bigbigben
Obsidian | Level 7

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.

5 REPLIES 5
DanH_sas
SAS Super FREQ

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

bigbigben
Obsidian | Level 7

Dear Dan:

Thanks.

I will try what you suggested.

bigbigben
Obsidian | Level 7

Hi, Dan:

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

DanH_sas
SAS Super FREQ

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.

bigbigben
Obsidian | Level 7

Dan: That is great! Thanks.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1423 views
  • 1 like
  • 2 in conversation