BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
yondy
Calcite | Level 5

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;

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

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

View solution in original post

3 REPLIES 3
pink_poodle
Barite | Level 11

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

 

 

DanH_sas
SAS Super FREQ

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

yondy
Calcite | Level 5

That did the trick!  Thank you!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 3 replies
  • 3996 views
  • 2 likes
  • 3 in conversation