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!

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3 replies
  • 3069 views
  • 2 likes
  • 3 in conversation