Hi all,
Is there a way to limit the number of tick marks on the x axis on a PROC SGPLOT series graph? My data is set up by month and I only want to show 18 months at a time (the most recent 18 months). Is there a way to set this up so that each month, the oldest month rolls off? Thanks in advance!
The best way to do this is to put a WHERE clause on PROC SGPLOT with a macro variable for the date value. Then, compute the date value relative to the current date and set it on the variable.
As for tick value control, you can use the INTERVAL option on the SGPLOT axis statements to control the time interval displayed for the major tick marks.
Hope this helps!
Dan
The best way to do this is to put a WHERE clause on PROC SGPLOT with a macro variable for the date value. Then, compute the date value relative to the current date and set it on the variable.
As for tick value control, you can use the INTERVAL option on the SGPLOT axis statements to control the time interval displayed for the major tick marks.
Hope this helps!
Dan
Great. Thank you!
Hello,
You can use the VALUES option in the XAXIS statement to control the tick marks on the x-axis.
If your x-value is a date value then you can use something like this below:
XAXIS VALUES = ("25MAY08"d "04JUL08"d "23AUG08"d);
The above code will places tick marks at 25MAY08, 04JUL08, and 23AUG08. You can edit it to get what you want though, for example put the 18 months of your choice.
You could also use a where clause in your dataset to limit to observations to the last 18 months. This can be done automatically using the &sysdate and also finding out the date of &sysdate - 18 months.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: