BookmarkSubscribeRSS Feed
juanvg1972
Pyrite | Level 9

 

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:

 

ejes.png

 

Any advice will be greatly appreciated.

 

 

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Move to sgplot, it is far simpler to any type of graph with the modern graphing setup, for instance:

http://documentation.sas.com/?docsetId=grstatproc&docsetTarget=p0wvmd88sz151ln1i1vx8l72b73c.htm&docs...

ballardw
Super User

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

juanvg1972
Pyrite | Level 9

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;
GraphGuy
Meteorite | Level 14

add the following to both axis statements ...

 

order=(200 to 1200 by 200)

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 4 replies
  • 1769 views
  • 4 likes
  • 4 in conversation