Are the upside and rightside ticks available in GPLOT/SGPLOT?
In the following, I added the rightside ticks manually, but wonder whether there is any embedded function.
data _;
do x=0 to 6.28 by 0.01;
y=sin(x);
output;
end;
run;
symbol1 i=join;
symbol2 i=none;
axis1 order=(-1 to 1 by 1) minor=none;
axis2 order=(0 to 6.28 by 1.57) minor=none;
proc gplot;
plot1 y*x/vaxis=axis1 haxis=axis2 nofr;
plot2 y*x/vaxis=axis1 haxis=axis2 nofr overlay;
run;
quit;
With gplot, you can add a 'plot2' to get an axis on the right-hand side. I typically plot the same data a 2nd time, but use a blank/invisible marker value and line interpolation.
symbol1 value=none interpol=join color=blue;
symbol2 value=none interpol=none color=white;
axis1 order=(0 to 225 by 25) minor=none offset=(0,0);
axis2 label=none order=('01jan1990'd to '01jan2000'd by year) minor=none;
title1 ls=1.5 h=20pt "IBM Stock Price";
proc gplot data=sashelp.stocks (where=(stock='IBM'));
format date year4.;
plot close*date=1 / vaxis=axis1 haxis=axis2;
plot2 close*date=2 / vaxis=axis1 haxis=axis2;
run;
Here's one way to get an axis on the right-side with sgplot:
title1 ls=1.5 h=20pt "IBM Stock Price";
proc sgplot data=sashelp.stocks (where=(stock='IBM')) noautolegend;
format date year4.;
series y=close x=date / lineattrs=(color=blue);
scatter y=close x=date / y2axis markerattrs=(size=0px color=blue symbol=circlefilled);
yaxis values=(0 to 225 by 25);
y2axis values=(0 to 225 by 25);
xaxis display=(nolabel) values=('01jan1990'd to '01jan2000'd by year);
run;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.