BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Junyong
Pyrite | Level 9

Are the upside and rightside ticks available in GPLOT/SGPLOT?

1.png

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;

2.png

1 ACCEPTED SOLUTION
3 REPLIES 3
GraphGuy
Meteorite | Level 14

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;

 

gplot12.png

GraphGuy
Meteorite | Level 14

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;

 

SGPlot15.png

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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