BookmarkSubscribeRSS Feed
Pritish
Quartz | Level 8

Hi All - I am trying to plot year-quarter values on the x axis using sgplot and have around 50 labels. When I use SGPlot, it only shows every alternative year quarter instead of all the 50 labels. Is there any way, I can show all possible value on the x-axis? I did explore 'values' options, but it might not a good option as the year-quarter information will vary based on my data. 

Any thoughts / guidance will be appreciate. 

8 REPLIES 8
DanH_sas
SAS Super FREQ

What do you get when you specify INTERVAL=QUARTER on your XAXIS statement?

Pritish
Quartz | Level 8
I tried Interval = quarter option, however it does not show all the possible values. It skips every 2/3 quarters.
ballardw
Super User

Please show the entire code you are using.

 

Also it may help to tell us the format currently assigned to the x-axis variable.

 

Are you getting any notes in the log about fitting values to your axis space?

Pritish
Quartz | Level 8
Below is the code which I am using:
/* x axis column date_mmddyyyy has the format mmddyy10. : for ex: 03/31/2009 */

proc sgplot data=graph;
XAXIS Label="YYYYQ" valuesformat=yyq6.
interval=quarter valuesrotate=vertical fitpolicy=rotate;
band x=date_mmddyyyy lower=0 upper= _freq_ / y2axis name="v3";
series x=date_mmddyyyy y=mean;
series x=date_mmddyyyy y=median;
run;
Below is the note, I get when I execute the program.
NOTE: TICKVALUEFITPOLICY=Rotate is ignored when SPLITTICKVALUE=TRUE. The default THIN policy is used.
NOTE: Some of the tick values have been thinned.
NOTE: TICKVALUEFITPOLICY=Rotate is ignored when SPLITTICKVALUE=TRUE. The default THIN policy is used.
NOTE: Some of the tick values have been thinned.
Rick_SAS
SAS Super FREQ

For date axes, PROC SGPLOT will perform special processing to handle the fact that months are different lengths. The NOTE is telling you that the special processing is occurring. For example, see the results of each of these calls:

 

proc sgplot data=sashelp.stocks;
series x=date y=open / group=stock;
run;

proc sgplot data=sashelp.stocks;
where date < '01jan1990'd;
series x=date y=open / group=stock;
run;

 

Tom
Super User Tom
Super User

Smaller font?  Larger plot? Rotate the axis labels?

Pritish
Quartz | Level 8

I have not tried reducing the font size. I will give it a try and see if it works. 

Barkat
Pyrite | Level 9

Try the following

xaxis values=(a to b by 1);

 

a means the start value

b means the end value

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 8 replies
  • 4001 views
  • 0 likes
  • 6 in conversation