BookmarkSubscribeRSS Feed
ChrilleB
Calcite | Level 5
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 🙂

Thank you in advance,
Christian.
7 REPLIES 7
GraphGuy
Meteorite | Level 14
You'll want to google for the keywords 'gplot' and 'overlay', I believe.
Paige
Quartz | Level 8
Before you call GPLOT, you should create a new variable that has Y1 and Y2 combined properly.
ChrilleB
Calcite | Level 5
In what way do you mean 'properly'?
Paige
Quartz | Level 8
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.
ChrilleB
Calcite | Level 5
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.
GraphGuy
Meteorite | Level 14
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;
ChrilleB
Calcite | Level 5
Thank you! Much appreciated! 🙂

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 7 replies
  • 885 views
  • 0 likes
  • 3 in conversation