Hi All
I am interested in plotting graphs using same scale! The below code plots two series using overlay however each series is given a different scale on Y1 and Y2 axis. Please can you help on how we modify the code to have both series of data on the same scale?
Context:
I need to make sure the p-scores (probabilities) reflect actual response rates in our campaign history. These plots help us with that activity. Many Thanks
Here is the code...
%_eg_conditional_dropds(WORK.SORTTempTableSorted);
/* -------------------------------------------------------------------
Sort data set WORK.LIFT2
------------------------------------------------------------------- */
PROC SORT
DATA=WORK.LIFT2(KEEP=decile resprate mean_score)
OUT=WORK.SORTTempTableSorted
;
BY decile;
RUN;
SYMBOL1
INTERPOL=JOIN
HEIGHT=10pt
VALUE=NONE
LINE=1
WIDTH=2
CV = _STYLE_
;
SYMBOL2
INTERPOL=JOIN
HEIGHT=10pt
VALUE=NONE
LINE=1
WIDTH=2
CV = _STYLE_
;
Legend1
FRAME
;
Axis1
STYLE=1
WIDTH=1
MINOR=NONE
;
Axis2
STYLE=1
WIDTH=1
MINOR=NONE
;
Axis3
STYLE=1
WIDTH=1
MINOR=NONE
LABEL=NONE
;
TITLE;
TITLE1 "Line Plot";
FOOTNOTE;
FOOTNOTE1 "Generated by the SAS System (&_SASSERVERNAME, &SYSSCPL) on %TRIM(%QSYSFUNC(DATE(), NLDATE20.)) at %TRIM(%SYSFUNC(TIME(), TIMEAMPM12.))";
PROC GPLOT DATA = WORK.SORTTempTableSorted
;
PLOT resprate * decile /
OVERLAY
VAXIS=AXIS1
HAXIS=AXIS2
HREVERSE
FRAME LEGEND=LEGEND1
;
PLOT2 mean_score * decile = 2 /
OVERLAY
VAXIS=AXIS1
OVERLAY
LEGEND=LEGEND1
;
run; quit;
By default, the gplot axes auto-scale to fit the data ... if you plot slightly different data, the auto-scale axes will be slightly different.
Since you want the axes to be exactly the same, you can hard-code the range of the axes, rather than letting them auto-scale. Since you use axis1 for both the left & right axes, you will only need to hard-code it in the axis1 statement. Something like ...
axis1 order=(0 to 100 by 20) ...
Thank You Robert...
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.