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)

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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