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.
How could we (if possible) display the value of a 4th variable?
I hope my question is clear enough.
Thanks in advance.
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.
Yes, I didn't produce any code to make this popup. The popup with the 3 variables is made by PROC GPLOT by default.
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.
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:
@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.
How could we (if possible) display the value of a 4th variable?
I hope my question is clear enough.
Thanks in advance.
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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: