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!
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.