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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 3034 views
  • 0 likes
  • 6 in conversation