01-12-2013 12:54 AM
With SGPLOT, you can get a graph that shows the data in the same way but maybe not the exact "look" you showed, like the x axis in the middle. Here is the graph and the code:
do x=0 to 3 by 0.1;
ods graphics / reset width=6in height=4in imagename='DualAxes';
proc sgplot data=curves noautolegend;
series x=x y=y1;
series x=x y=y2 / y2axis;
yaxis min=0 offsetmin=0.5 display=(nolabel);
y2axis max=0 offsetmax=0.5 display=(nolabel);
If it is important to get a "look" closer to your graph, you can do it using GTL. Both these need SAS 9.2 or later. If you are interested, I can work up that code.
01-15-2013 01:03 AM
Thanks for your answer. Eventhough it helps , I am still struggling to get the final one. In my case refline is not zero as the range of left hand y-axis is something like 50 t0 60 and right hand y axis is something like -3 to 5.
01-15-2013 01:10 AM
That is not a problem. Your Y axis can be 50 - 60 and Y2 from -3 to 5. You can set a reference line at Y=50 or Y2=-3. I actually set Y axis min=0 and Y2axis max=0. If you want, you can set these to whatever values you want. It is very flexible.
01-14-2013 08:29 AM
I'm not able to view your attached file correctly, but here is a simple example showing how to add a second vertical axis (on the right-hand-side) in gplot ...
axis1 order=(0 to 80 by 20);
axis2 order=(0 to 150 by 25);
symbol1 value=dot interpol=join color=red;
symbol2 value=dot interpol=join color=blue;
proc sort data=sashelp.class out=class; by name; run;
proc gplot data=class;
plot height*name=1 / vaxis=axis1 haxis=axis3;
plot2 weight*name=2 / vaxis=axis2;