Hi. Is there a way to add a quarterly tickmark without label in between my labeled tick marks?
In other words, I would want to see a tick mark in March and October for each year without a label.
Current code used below. I've tricked tinkering with adding minor and minorinterval options but it hasn't produced the change I want.
Xaxis label="Monthly time series data" values=("01JAN19"d to "30SEP23"d by quarter) labelattrs=(family=arial size=11 weight=bold) Valueattrs=(family=arial size=10) valuesformat=monyy.;
I should also say I'm not exactly sure why it's displaying the monyy and tick mark every 6 months even though I have "by quarter" in the values statement. That is fine, but if someone could help explain why I'd appreciate it.
I think that is due to you have too many values/month to plot in X axis.
proc sgplot data=sashelp.stocks; where year(date) in ( 2001 2002 2003 2004); series x=date y=close/group=stock; Xaxis label="Monthly time series data" values=("01JAN2001"d to "01Jan2004"d by quarter) type=discrete fitpolicy=rotate ; run;
This does produce quarterly intervals, but it applies a label to every tick mark (quarterly). Is there a way to get a tick mark without a label at the quarterly intervals?
In other words:
MAR19
tick (for JUN19, no label)
SEP19
tick (for DEC 19, no label)
MAR20
...etc.
On your XAXIS statement, set these two options:
MINOR MINORINTERVAL=quarter
Hope this helps!
Thanks for this suggestion. I was able to make this work within a test plot. Not sure why it isn't working in my macro though.
Definitely not a pressing issue but if you have any other ideas please let me know. Thanks!
Xaxis label="Monthly time series data" Values=("01MAR19"d to "30SEP23"d by quarter) minor minorinterval=month labelattrs=(family=arial size=11) valueattrs=(family=arial size=10) valuesformat=monyy.;
An alternative way is using valuesdisplay= option:
proc sgplot data=sashelp.stocks; where year(date) in ( 2001 2002 ); series x=date y=close/group=stock; Xaxis label="Monthly time series data" values=("01JAN2001"d to "01jan2002"d by month) valuesdisplay=('Jan01' ' ' ' ' 'Apr01' ' ' ' ' 'Jul01' ' ' ' ' 'Oct01' ' ' ' ' 'Jan02') type=linear ; run;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.