BookmarkSubscribeRSS Feed
Rambo
Calcite | Level 5

HI,

I am trying to create an activex plot that enables me to visualize the relationship between multiple variables.  However, I only want two variables to show at a time.  To help illustrate my question, please see the example code below.  Ideally, the code would create a scatter plot of var3 by x as the default graph.  Then, if I were to right click the graph and choose data options, I would be able select var1 or var2 in  the Response drop down menu.

Note:  Currently, the Response drop down only shows the var3 and x.  I have also changed the plot line to (var1 var2 var3)*x/overlay, but then all three responses are plotted against the X and I cannot find a way to "remove" two from the graph.

Thanks in advance!


data testdata;   

     do x = 1 to 15;      

           var1 = x;      

           var2 = -x;      

           var3 = 7.5 + ((-1)**((mod(x,2)=0)))*(7.5-x);      

           output;   

      end;

run;

ods html path="%sysfunc(pathname(work))" file="test.html";

goptions device=activex;

proc gplot data=testdata;       

plot var3*x;

run;

ods html close;

2 REPLIES 2
DanH_sas
SAS Super FREQ

When client-based output is generate, only the data necessary to render the graph is sent to the client. Therefore, you have to find a creative way to send the extra data. One suggestion would be to use the POINTLABEL option to send  the extra data and just turn off the data labels when you bring up the graph. The extra variables should now be in your menu. Your code for this approach should look something like the following:

data testdata;  

     do x = 1 to 15;     

           var1 = x;     

           var2 = -x;     

           var3 = 7.5 + ((-1)**((mod(x,2)=0)))*(7.5-x);     

           output;  

      end;

run;

ods html path="%sysfunc(pathname(work))" file="test.html";

goptions device=activex;

symbol1 v=none pointlabel=("#var1:#var2");

proc gplot data=testdata;      

plot var3*x;

run;

ods html close;

Hope this helps!

Dan

Rambo
Calcite | Level 5

HI Dan,

I tried your solution but I did not have var1 and var2 available in the drop down menu.  Any thoughts?

Picture1.png

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
  • 2 replies
  • 769 views
  • 0 likes
  • 2 in conversation