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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1 reply
  • 684 views
  • 0 likes
  • 2 in conversation