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.
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
Dear Dan:
Thanks.
I will try what you suggested.
Hi, Dan:
A follow up question: is there ways to only specify the incremental value without specifying the boundaries?
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.
Dan: That is great! Thanks.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.