BookmarkSubscribeRSS Feed
Calcite | Level 5
Hi All,

On a pdf that I create the number of ticks are quite annoying and makes the axis look cramped up.

Is there a way to set the number of ticks? So I have nice spaced out ticks without actually messing with the size of the actual graph?

I also DONT want to use something like
axis2 order=(70 to 80 by 2)
because I dont know the minimum or maximum value of the data prior to the program running.


Message was edited by: SachinRuk Message was edited by: SachinRuk
For the classic SAS/GRAPH procedures, you do not necessarily have to know what values will be on the axis to just turn minor tick marks off. This syntax turns off minor tick marks without specifying the ORDER= option.
axis1 minor=none;
axis2 minor=none;

ods listing;
proc gplot data=sashelp.heart;
plot cholesterol * ageatdeath /
haxis=axis1 vaxis=axis2 ;

Otherwise, there are some other procedure action statement options such as HMINOR= and VMINOR= that turn off major tick marks. There's also the STAGGER option that may work to "thin out" the axis tick marks without an explicit ORDER= option.

Here are some links to the doc:

You indicated that your destination was PDF, but you did not show what your SAS/GRAPH procedure of choice was. I only showed GPLOT, but other SAS/GRAPH procedures have similar types of AXIS control available.

Calcite | Level 5
Hi Cynthia,

I did not mean the minor tick marks and have already turned them off, but thank you none the less :). and yes I am using gplot.

I suppose I should have reworded my question regarding the order statement. I dont mind it as long as its in the form:

axis2 order=(min_data to max_data by (max_data-min_data)/5)

but would be great if i could suppress say, every second label/ (and its tick mark) from the axis instead.

If you used a procedure to create a macro variable for the start value (based on min value) and a macro variable for the max value (based on the max value) and a third macro variable for the BY value. As long as you were going to create macro variables, you could use other techniques to create a list with the exact tick marks you want.

However, if you were going to create macro variables, then your AXIS statement would look something like this:
axis2 order=(&minval to &maxval by &byval)

This means that you would have to create the macro variables &MINVAL, &MAXVAL and &BYVAL before your GPLOT. For an example, look at the creation of the &AVERAGE macro variable in Step 4 of this paper:

Quartz | Level 8
The document that Cynthia pointed you to will help you to understand more about macro variables and how to generate them in an automated way. Do get your mind around that sometime soon.

In case you are being held captive by a deadline, you might find the code below helpful. In your case, you would want to add the min dimension (mine was always zero for this job) and force the min/max difference to be evenly divisible by a reasonable increment (by)value.

proc summary data=ClaimDnomBars nway;
var pct;
output out=max max=;

data _null_;
set max;
if ceilpct le 2 then do;call symput("max",2);call symput("incr",0.5);end;
else if ceilpct le 5 then do;call symput("max",5);call symput("incr",1);end;
else if ceilpct le 10 then do;call symput("max",10);call symput("incr",2);end;
else if ceilpct le 30 then do;max=round(ceilpct,10);
if max lt ceilpct then max+10;
call symput("max",max);call symput("incr",5);end;
else if ceilpct gt 30 then do;max=round(ceilpct,10);
if max lt ceilpct then max+10;
call symput("max",max);call symput("incr",10);



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
  • 4 replies
  • 3 in conversation