I'm still new to SAS and am learning. I tried searching the forum, but perhaps was not using the right key terms.
Is there a way to limit the number of ticks for an sgplot function? Right now, I have around 100 plus rows, but since I am using vbar, that is way too many ticks along the x axis. I tried changing the values using the values option, but that only reduced the data shown.
I still want to show all the bars, but not have a tick underneath each of them. Only have a tick for every 10 values.
proc sgplot data=mainlib.data;
vbar day / response=col1 group=type nostatlabel;
run;
For a discrete axis (like for VBAR), try using a FITPOLICY on the XAXIS statement:
proc sgplot data=mainlib.data;
xaxis fitpolicy=thin;
vbar day / response=col1 group=type nostatlabel;
run;
There are a number of policies from which to choose. See the documentation for further details about each one.
Hope this helps!
Dan
I see a variable named day. If x is a time axis, then you can use the INTERVAL= option in the XAXIS statement.
I would use INTERVAL= auto, to let SAS determine the optimal spacing of tick marks. [1, 2]
proc sgplot data=mainlib.data;
vbar day / response=col1 group=type nostatlabel;
xaxis interval=auto;
run;
References
[1] PROC SGPLOT: INTERVAL= option of XAXIS statement
[2] SAS Community Post: intervals on x-axis
For a discrete axis (like for VBAR), try using a FITPOLICY on the XAXIS statement:
proc sgplot data=mainlib.data;
xaxis fitpolicy=thin;
vbar day / response=col1 group=type nostatlabel;
run;
There are a number of policies from which to choose. See the documentation for further details about each one.
Hope this helps!
Dan
That did the trick! Thank you!
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.
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.