BookmarkSubscribeRSS Feed
Pyrite | Level 9

Hi, there:



I have trouble to adjust axis X's attribute.

data test;
    input id x y @@;
    1 -1 20 1 99 15 1 200 17 1 301 20 1 400 25
symbol1 color=black value=circle repeat=1 interpol=join height=2;
axis1 minor=none label=(angle=90 rotate=0 height=2cells "Y")
    order=0 to 30 by 10;
axis99 minor=none label=(angle=0 rotate=0 height=2cells "X")
    order=-100 to 400 by 100
    value=(angle=0 rotate=0 height=2cells font="Times New Roman"
           tick=1 height=2cells " " justify=center height=2cells " "
           tick=2 height=2cells "Day" justify=center height=2cells "0"
           tick=3 height=2cells "Day" justify=center height=2cells "100"
           tick=4 height=2cells "Day" justify=center height=2cells "200"
           tick=5 height=2cells "Day" justify=center height=2cells "300"
           tick=6 height=2cells "Day" justify=center height=2cells "400"
proc gplot data=test;
    plot y*x=id / haxis=axis99 vaxis=axis1;


On axis X, I want these ticks (Day0, Day100, Day200, Dya300, Day400), but I don't need such as blank on Day0's left (I want smaller one).

In my dataset, there is X=-1 (lesser than Day0), so in this case, using OFFSETMIN= in PROC SGPLOT acts well, I know.

But I don't know how I can in PROC GPLOT. Please help me.


Thanks in advance.



Jade | Level 19



Since your X variable is continuous* rather than nominal, it might be acceptable to display intermediate tick marks.


In this case you could change the ORDER= option of AXIS99 to, say,

order=-10 to 400 by 10

and hide the repetitive part of the VALUE= specification in a macro:

    value=(angle=0 rotate=0 height=2cells font="Times New Roman"

Macro definition (depending on the ORDER= specification, of course):

%macro ticks;
  %local t;
  %do t=1 %to 42;
    %if %sysfunc(mod(&t,10))=2 %then
      tick=&t height=2cells "Day" justify=center height=2cells "%eval(-20+&t*10)";
      tick=&t height=2cells " " justify=center height=2cells " ";
%mend ticks;


Other suggestions (some of which allow the omission of the intermediate tick marks) can be found in this paper.


*(EDIT: in the sense that its values can slightly depart from the few tick mark values you want to display)

Pyrite | Level 9

Hi, FreelanceReinhard:



Thanks so much.

In order to delete intermediate ticks, I try yours.

Please wait until I report this result.

Thanks again.



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
  • 2 replies
  • 1 like
  • 2 in conversation