BookmarkSubscribeRSS Feed
sasgorilla
Pyrite | Level 9

Hi. Is there a way to add a quarterly tickmark without label in between my labeled tick marks? 

 

 

sasgorilla_0-1745879465933.png

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.;

 

6 REPLIES 6
sasgorilla
Pyrite | Level 9

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. 

Ksharp
Super User

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;

Ksharp_0-1745890271718.png

 

sasgorilla
Pyrite | Level 9

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. 

DanH_sas
SAS Super FREQ

On your XAXIS statement, set these two options:

MINOR MINORINTERVAL=quarter

 

Hope this helps!

sasgorilla
Pyrite | Level 9

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.;
Ksharp
Super User

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;

Ksharp_0-1746496745055.png

 

 

 

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 532 views
  • 1 like
  • 3 in conversation