BookmarkSubscribeRSS Feed
Suzanevara
Calcite | Level 5

Hi All,

 

I would like to know if it's possible to display a popup window while hovering the graph with the mouse on a reference line on a Gplot (it is essential that I continue with a Gplot).

 

Here's my code and my graph:

 

proc sql noprint;

select catx('','"',Name,'"') as ListName into :NameRefline separated by " " from sashelp.class where Height GT 65;

quit;

%put &NameRefline;

 

goptions xpixels=1200 ypixels=675;

proc gplot data=SASHELP.CLASS;

plot Name*Height=Sex / vref=&NameRefline cvref=orange;

run;

 

 class.png

 

The idea here is to show the Weight of the people with the refline in a popup. I don't want to put it on the graph because the graph will be difficult to read. I hope I'm clear enough. Thanks!

7 REPLIES 7
PeterClemmensen
Tourmaline | Level 20

I'm not sure if this works with PROC GPLOT, but with PROC SGPLOT you can use the IMAGEMAP Option to the ODS Graphics statement like this

 

ods graphics on / imagemap;
proc sgplot data=sashelp.class;
   scatter x=height y=weight;
   refline 60 / axis=x;
run;
PeterClemmensen
Tourmaline | Level 20

Also, why is it essential that you continue with a GPLOT? Almost everyone in here will advise you to use the newer PROC SGPLOT?

PaigeMiller
Diamond | Level 26

@PeterClemmensen wrote:

Also, why is it essential that you continue with a GPLOT? Almost everyone in here will advise you to use the newer PROC SGPLOT?


Why? Because this is the second almost identical question today about GPLOT (https://communities.sas.com/t5/SAS-GRAPH-and-ODS-Graphics/PROC-GPLOT-and-popup/m-p/481460#M16627) by two different people, strongly suggesting this is a homework assignment.

--
Paige Miller
PeterClemmensen
Tourmaline | Level 20

Strong reasoning indeed @PaigeMiller 🙂

Suzanevara
Calcite | Level 5

Why a Gplot because at work I use a project with a lot of macros and it generates lots of graphs automatically. We cannot change right now the way we work.

PaigeMiller
Diamond | Level 26

@Suzanevara wrote:

Why a Gplot because at work I use a project with a lot of macros and it generates lots of graphs automatically. We cannot change right now the way we work.


Ok, then suggestions were given above about other solutions using GPLOT than a pop-up on a reference line, which is not possible as far as I know.

--
Paige Miller
PaigeMiller
Diamond | Level 26

I am not aware of any way to produce tool-tips for reference lines using GPLOT, nor am I aware of any way to produce tool-tips for reference lines using the annotate facility. You could create a tool-tip for the data point (not the reference line).

 

Of course, I must ask ... why does the solution have to be a tool-tip (or pop-up as you call it)? Why not do a bubble plot which shows the weight instead of a regular scatterplot?

--
Paige Miller

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