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!

SAS INNOVATE 2024

Innovate_SAS_Blue.png

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. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 3 replies
  • 2646 views
  • 2 likes
  • 3 in conversation