Calcite | Level 5

## Two different variables on positive and negative part of the Y-axis

Hi!

I'm trying to create a graph that has one variable (Y1) on the positive part of the Y-axis, and another variable (Y2) on the negative part of the Y-axis. Both Y1 and Y2 has the X-axis in common.

If its possible I want both Y1 and Y2 to seperatly go towards positive infinity.

My question: How do I create this Y1 Y2 thing? Preferably in proc gplot if you have the expertise to help me out with some guidence or a keyphrase that I can continue googling with 🙂

Christian.
7 REPLIES 7
Meteorite | Level 14

## Re: Two different variables on positive and negative part of the Y-axis

You'll want to google for the keywords 'gplot' and 'overlay', I believe.
Quartz | Level 8

## Re: Two different variables on positive and negative part of the Y-axis

Before you call GPLOT, you should create a new variable that has Y1 and Y2 combined properly.
Calcite | Level 5

## Re: Two different variables on positive and negative part of the Y-axis

In what way do you mean 'properly'?
Quartz | Level 8

## Re: Two different variables on positive and negative part of the Y-axis

In what way do you mean "I'm trying to create a graph that has one variable (Y1) on the positive part of the Y-axis, and another variable (Y2) on the negative part of the Y-axis"??

More detail would help.
Calcite | Level 5

## Re: Two different variables on positive and negative part of the Y-axis

I created a picture to illustrate what I want to do: http://oi56.tinypic.com/rwhxyv.jpg

The orange (unnamed) variable is the one I'm having difficulties with.
Var1-Var3 and the "orange" variable are recorded over time and I want to be able to see what happens with the other variables (var1-var3) when the "orange" changes.

The infinity marks are just there to point out that I want to have both Y1 and Y2 to be positive regarding vertical direction from origo.

Thank you.
Meteorite | Level 14

## Re: Two different variables on positive and negative part of the Y-axis

data foo;
input x var1 var2 var3 var4;
datalines;
1 1 2 4 -3
2 .5 3 4 -3
3 .1 2 4 -4
4 .01 1 3.5 -4
;
run;

axis1 label=none value=none order=(-5 to 5 by 1) major=none minor=none;
axis2 label=none value=none major=none minor=none;

symbol1 value=none interpol=sm50 color=blue;
symbol2 value=none interpol=sm50 color=red;
symbol3 value=none interpol=sm50 color=green;
symbol4 value=none interpol=steplj color=orange;

proc gplot data=foo;
plot var1*x=1 var2*x=2 var3*x=3 var4*x=4 / overlay
vaxis=axis1 vref=0 cvref=black wvref=2 haxis=axis2 noframe;
run;
Calcite | Level 5

## Re: Two different variables on positive and negative part of the Y-axis

Thank you! Much appreciated! 🙂
Discussion stats
• 7 replies
• 787 views
• 0 likes
• 3 in conversation