Hi,
I am doing a simple plot with proc GPLOT y have two values in vertical axis (left and right).
When I show the graph I don't have the same top value in both axis, is possible to set the same top for boh axis,
for example, range 200 to 1200 for axis1 and axis2.
my code:
PROC GPLOT DATA = predic3;
PLOT val_real * date /
VAXIS=AXIS1
HAXIS=AXIS2
FRAME LEGEND=real;
PLOT2 val_pre * date = 2 /
VAXIS=AXIS3
OVERLAY LEGEND=previsto ;
run;
and my plot:
Any advice will be greatly appreciated.
Move to sgplot, it is far simpler to any type of graph with the modern graphing setup, for instance:
If you are going to reference AXIS statements then you should show the code for the axis statements used.
I am going to guess that one or both do not have Order sections to control the tick mark values
This is my code. Thanks for your help:
PROC SORT
DATA=WORK.PREDIC3(KEEP=DATE val_real val_pre)
OUT=WORK.SORTTempTableSorted
;
BY DATE;
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
;
TITLE;
TITLE1 "Gráfico de línea";
FOOTNOTE;
FOOTNOTE1 "Generado por el Sistema SAS (&_SASSERVERNAME, &SYSSCPL) el %TRIM(%QSYSFUNC(DATE(), NLDATE20.)) a las %TRIM(%SYSFUNC(TIME(), TIMEAMPM12.))";
PROC GPLOT DATA = WORK.SORTTempTableSorted
;
PLOT val_real * DATE /
VAXIS=AXIS1
HAXIS=AXIS2
FRAME LEGEND=LEGEND1
;
PLOT2 val_pre * DATE = 2 /
VAXIS=AXIS3
OVERLAY
LEGEND=LEGEND1
;
/* -------------------------------------------------------------------
Fin de código de la tarea
------------------------------------------------------------------- */
RUN; QUIT;
add the following to both axis statements ...
order=(200 to 1200 by 200)
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: