BookmarkSubscribeRSS Feed
wkossack
Calcite | Level 5
I have a regression and I'm trying to plot the predicted with the actual on the same plot. I'm trying to get the verticle scale to be the same but for some reason one chart has the right axis different than the left

SYMBOL1 INTERPOL=JOIN HEIGHT=10pt VALUE=CIRCLE LINE=1 WIDTH=2;

Axis1 STYLE=1 WIDTH=1 Major = (NUMBER=5) MINOR=NONE;
Axis2 STYLE=1 WIDTH=1 MINOR=NONE ;
Axis3 STYLE=1 WIDTH=1 Major = (NUMBER=5) MINOR=NONE;

TITLE1 "Scatter Plot";
FOOTNOTE;

PROC GPLOT DATA=PREDLINREGPREDICTIONS NOCACHE ;
format offered COMMA12.;
format predicted_offered COMMA12.;
PLOT offered * month_year=1 / VAXIS=AXIS1 HAXIS=AXIS2
FRAME VZERO LEGEND=LEGEND1;
PLOT2 predicted_offered * month_year = 2 /
VAXIS=AXIS3 LEGEND=LEGEND1 VZERO OVERLAY;
BY Grouping;

what am I missing?
1 REPLY 1
GraphGuy
Meteorite | Level 14
If you don't specify an "order={min} to {max} by {something}" in your axis statements, then the plot and plot2 axes will each auto-scale based on the data that's being plotted against that axis.

One alternative to plotting the 2 lines via plot and plot2 is to plot them both with the plot statement (using the 'overlay' option). You will only get an axis on the left side, and you are guaranteed that axis is auto-scaled the same for both lines (ie, because it *is* the same axis 🙂

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 957 views
  • 0 likes
  • 2 in conversation