Hi,all 🙂
I'm looking for a way to add margin (space / offset) between tick and tick label with proc gplot.
Even with the method in the case of "proc sgplot", it is ok, but we are seeking information with proc gplot as much as possible.
I attach an image if what I want to do.
Those who knows, thank you for your cooperation.
proc sgplot data=sashelp.class;
reg x=height y=weight;
run;
output image of above code is
And what I want to do is below.
Check X axis label position.
Have a fine day.
Here are three starter solutions. Each could be refined depending on which way works best for you.
symbol v=dot color=blue;
* Solution #1;
axis1 order=(11 to 16)
minor=none
major=(height=10 color=white );
proc gplot data=sashelp.class;
plot height*age/haxis=axis1;
run;
quit;
* Solution #2;
goptions reset=axis;
axis1 style=0;
axis2 order=(40 to 80 by 10)
value=(t=1 color=white)
minor=(n=1);
proc gplot data=sashelp.class;
plot height*age/haxis=axis1
vaxis=axis2
vref=50;
run;
quit;
* Solution #3;
goptions reset=axis;
axis1 style=0;
axis2 offset=(10)
minor=(n=1);
proc gplot data=sashelp.class;
plot height*age/haxis=axis1
vaxis=axis2
vref=50;
run;
quit;
* Solution #4;
goptions reset=axis;
axis1 style=0;
axis2 style=0
offset=(10)
minor=(n=1);
data anno (keep=function xsys ysys x y line);
retain xsys ysys '2' line 1 x 11;
function='move';
y=50; output anno;
function='draw';
y=80; output anno;
run;
proc gplot data=sashelp.class
anno=anno;
plot height*age/haxis=axis1
vaxis=axis2
vref=50;
run;
quit;
Here are three starter solutions. Each could be refined depending on which way works best for you.
symbol v=dot color=blue;
* Solution #1;
axis1 order=(11 to 16)
minor=none
major=(height=10 color=white );
proc gplot data=sashelp.class;
plot height*age/haxis=axis1;
run;
quit;
* Solution #2;
goptions reset=axis;
axis1 style=0;
axis2 order=(40 to 80 by 10)
value=(t=1 color=white)
minor=(n=1);
proc gplot data=sashelp.class;
plot height*age/haxis=axis1
vaxis=axis2
vref=50;
run;
quit;
* Solution #3;
goptions reset=axis;
axis1 style=0;
axis2 offset=(10)
minor=(n=1);
proc gplot data=sashelp.class;
plot height*age/haxis=axis1
vaxis=axis2
vref=50;
run;
quit;
* Solution #4;
goptions reset=axis;
axis1 style=0;
axis2 style=0
offset=(10)
minor=(n=1);
data anno (keep=function xsys ysys x y line);
retain xsys ysys '2' line 1 x 11;
function='move';
y=50; output anno;
function='draw';
y=80; output anno;
run;
proc gplot data=sashelp.class
anno=anno;
plot height*age/haxis=axis1
vaxis=axis2
vref=50;
run;
quit;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.