BookmarkSubscribeRSS Feed
0 Likes

Currently in SAS 9.4M7 it is possible to show the values of the x, y and response variable in the tooltip. These may be selected and formatted by "roles". In HEATMAPPARM one coloured rectangle represents one data row, so it would be possible to show the value of any variable in the dataset in the tooltip, e.g. some kind of unique identifier. This would be useful. Please add it.

7 Comments
ballardw
Super User

I suspect you could likely overlay a TEXT plot over the HEATMAPPARM to display other values as a tip.

Peter_L
Quartz | Level 8

Thanks @ballardw for the tip. You are partially right: I overlaid a TEXT plot and after a lot of messing about I managed to get tool-tips with my choice of variables to appear when pointing to parts of the heatmap blocks. As a number in the blocks was useful, I added that but was unable to make the area responsive to the tip any bigger than the digit itself. I tried adding a transparent fill, padding, adding spaces, splitting on space and keeping it. I ended up with a solution to my immediate use case but I suspect it may not work well for the many sizes of heatmap this graphic can potentially display. Let's see what the users say.

 

So, I couldn't confirm that it would be possible to add only a tool-tip with only invisible space text. Maybe it works if you make the text itself transparent. There's also the issue of the text overflowing the heatmap block and misaligning. I didn't investigate enough to determine if the font size can dynamically shrink to fit in the box. It would be a lot easier if HEATMAPPARM had a simple option.

ballardw
Super User

I'm glad my hint allowed you make something possibly usable.

 

Another approach that would require more data prep would be to code your own areas with POLYGON plots which appears to allow multiple variables to create tips.

MarciaS
SAS Employee

You can use the TIP= option on the HEATMAPPARM statement to specify the variables to include in the data tips. Does this option not provide the information you want to see?

ballardw
Super User

@MarciaS 

OP wants to use another variable that does not have an actual "role" in the HEATMAPPARM. The Tip= option for HEATMAPPARM is restricted those variables.

MarciaS
SAS Employee

The TIP= option on the HEATMAPPARM statement allows you to reference other variables from the data set. For example: 

   ods graphics / imagemap;
   proc sgplot data=sashelp.class;
     heatmapparm x=name y=age colorresponse=height /
        tip=(name age height weight);
   run;

 

The documentation for the HEATMAPPARM statement needs to be updated to include this information. 

 

The HEATMAP statement does restrict you to using the X, Y and COLORRESPONSE roles in the tips. If you need to have this functionality in a heat map, you will need to bin the data and use the HEATMAPPARM statement. 

Peter_L
Quartz | Level 8

Thanks @MarciaS , you are right: not only role keywords but also variables are allowed in the TIP= option of HEATMAPPARM. I have tried it and it gives a better solution than a TEXT plot as the tip-sensitive area is exactly the HEATMAPPARM block.

 

This is exactly what I was requesting. My request now seems to be to update the documentation.

 

When doing this, please explain how collisions between role keywords and variable names are avoided or handled. More generally, these role keywords are yet another identifier entity adding to the arbitrary syntax complexity that is such a challenge in SAS. In other places special variables are given distinctive names, e.g. _N_; why not follow this convention here too?