Data visualization with SAS programming

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

Reply
Occasional Contributor
Posts: 9

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 Smiley Happy

Thank you in advance,
Christian.
SAS Employee
Posts: 967

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.
Super Contributor
Posts: 281

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.
Occasional Contributor
Posts: 9

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

In what way do you mean 'properly'?
Super Contributor
Posts: 281

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.
Occasional Contributor
Posts: 9

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

Sorry, my bad.

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.
SAS Employee
Posts: 967

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;
Occasional Contributor
Posts: 9

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

Thank you! Much appreciated! Smiley Happy
Ask a Question
Discussion stats
  • 7 replies
  • 238 views
  • 0 likes
  • 3 in conversation