BookmarkSubscribeRSS Feed
CedricLVQ
Calcite | Level 5

Hello,

 

My question is relative to the information that is displayed when we are hovering the mouse on a graph made with PROC GPLOT like the one that follows:

 

PROC GPLOT DATA=dateset;

      PLOT Y * X = Z;

RUN;

 

When we are hovering the graph with the mouse there is a popup that comes out and display the information for the 3 X, Y and Z variables.

Picture1.png

How could we (if possible) display the value of a 4th variable?

 

I hope my question is clear enough.

 

Thanks in advance.

 

 

 

5 REPLIES 5
PaigeMiller
Diamond | Level 26

The code you show does NOT produce the pop-up. 

 

If you show the code that produces the pop-up when you hover your mouse, then adding a fourth variable is trivial.

--
Paige Miller
CedricLVQ
Calcite | Level 5

Yes, I didn't produce any code to make this popup. The popup with the 3 variables is made by PROC GPLOT by default.

 

 

PaigeMiller
Diamond | Level 26

Maybe you've got some option turned on that I don't know about, because GPLOT does not produce pop-ups by default. The only way I know of to get such a pop-up is via the HTML= option.

 

Anyway, I stand by my earlier statement, if you can program GPLOT to produce this pop-up, then adding a fourth variable is trivial.

--
Paige Miller
Reeza
Super User

Are you using a GUI interface or did you code that yourself?

 

I ran your code using HTML as the destination and do not get pop ups by default so you're doing something different than just running the code you've shown. Please explain in detail how you created that graph and we can help further. 

 

In general, GPLOT is considered outdated and SGPLOT is a lot more powerful and easy to use. 

 

If you have IMAGEMAP turned on with SGPLOT you get the pop ups by default, but not GPLOT that I can see.

 

 

ods html;  /* use HTML destination */
ods graphics on / imagemap; /* enable data tips */

proc gplot data=sashelp.cars;
plot mpg_city * weight = origin;
run; quit;

proc sgplot data=Sashelp.Cars;
scatter x=Weight y=MPG_City;
run;

Instructions on how to add additional variables values are illustrated here:

https://blogs.sas.com/content/iml/2011/12/09/creating-tooltips-for-scatter-plots-with-proc-sgplot.ht...

 


@CedricLVQ wrote:

Hello,

 

My question is relative to the information that is displayed when we are hovering the mouse on a graph made with PROC GPLOT like the one that follows:

 

PROC GPLOT DATA=dateset;

      PLOT Y * X = Z;

RUN;

 

When we are hovering the graph with the mouse there is a popup that comes out and display the information for the 3 X, Y and Z variables.

Picture1.png

How could we (if possible) display the value of a 4th variable?

 

I hope my question is clear enough.

 

Thanks in advance.

 

 

 


 

GraphGuy
Meteorite | Level 14

Sounds like you're probably using device=java or device=activex (either intentionally, or perhaps it's your default if you're running your graphs through Enterprise Guide, or something like that?) ... and those devices have default popup/mouse-over text.

 

You can control the mouse-over text by adding a variable to your dataset containing specially-formatted text which happens to be HTML 'title=' tags. Here's an example:

 

data foo; set sashelp.class;
length my_html $300;
my_html=
'title='||quote(
trim(left(name))||'0d'x||
'Sex: '||trim(left(sex))||'0d'x||
'Years old: '||trim(left(age))||'0d'x||
'Weight in pounds: '||trim(left(height))
);
run;

 

goptions device=java;
proc gplot data=foo;
plot height*weight=sex / html=my_html;
run;

 

popup.png

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1571 views
  • 0 likes
  • 4 in conversation