BookmarkSubscribeRSS Feed
SachinRuk
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.

Thanks,
Sachin

Message was edited by: SachinRuk Message was edited by: SachinRuk
4 REPLIES 4
Cynthia_sas
SAS Super FREQ
Hi:
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.
[pre]
axis1 minor=none;
axis2 minor=none;

ods listing;
proc gplot data=sashelp.heart;
plot cholesterol * ageatdeath /
haxis=axis1 vaxis=axis2 ;
run;
quit;
[/pre]

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:
http://support.sas.com/documentation/cdl/en/graphref/63022/HTML/default/viewer.htm#axischap.htm
http://support.sas.com/documentation/cdl/en/graphref/63022/HTML/default/viewer.htm#gplot-plot.htm

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.

cynthia
SachinRuk
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.

Thanks,
Sachin
Cynthia_sas
SAS Super FREQ
Hi:
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:
[pre]
axis2 order=(&minval to &maxval by &byval)
[/pre]

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:
http://www2.sas.com/proceedings/sugi28/056-28.pdf

cynthia
Bill
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=;
run;

data _null_;
set max;
ceilpct=ceil(pct);
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);
end;
run;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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
  • 4 replies
  • 1192 views
  • 0 likes
  • 3 in conversation