BookmarkSubscribeRSS Feed
Bill_in_Toronto
Obsidian | Level 7

Hi:

I would like to share a technique I discovered for producing mouseover text in PDF files created by PROC GPLOT. In SAS 9.2 the PROC GPLOT option  “HTML=” was introduced. This option allows plotted symbols to link to an HTML destination. The technique shown in the program below manipulates this option to provide a mouseover feature similar to that available in ODS HTML. The output PDF file is attached.

* Author: Bill Sukloff;

* Date: 2012-11-06

* Description: For PDF files, uses the option introduced in SAS 9.2 GPLOT of "HTML=" to display text when the mouse hovers over a plotted symbol;

* Caution: this feature may not work in some PDF readers (tested only in Adobe Reader);

DATA class_with_anno;

SET sashelp.class;

LENGTH anno_link $ 30;

* Normally you start the href text string with "http:". I found that replacing "http:" with ">:" looked nice and still resulted in the Adobe Reader interpreting the text string as an HTML link;

* Another option is to use a text string which simulates an arrow: "-->:";

IF   name NE ''

THEN anno_link = "href='>:"!!TRIM(LEFT(name))!!"'";

ELSE anno_link = "href='>:No name'";

RUN;

OPTIONS orientation=landscape PAPERSIZE=legal NODATE NONUMBER;

ODS HTML CLOSE;

ODS LISTING CLOSE;

ODS PDF FILE='c:\temp\sasgraph_pdf_example_mouseover.pdf' style=BarrettsBlue;

TITLE1 'SAS/Graph: PDF Mouseover using fake HTML links';

FOOTNOTE1 'Note: Place your mouse cursor over a plot symbol for information about the data value';

PROC GPLOT DATA=class_with_anno;

PLOT height * weight = sex  /

  HTML=anno_link

;

RUN;

QUIT;

ODS PDF CLOSE;

3 REPLIES 3
art297
Opal | Level 21

Nice and thanks for sharing.  I just sent you (well, hopefully it was your email address I found on the web) an email asking if you would be interested in turning this post into a 10-minute presentation for our upcoming (December 14, 2012) Toronto Area SAS Society meeting.

Bill_in_Toronto
Obsidian | Level 7

Hi Arthur:

  Sure, thanks for the offer.

ArtC
Rhodochrosite | Level 12

Thank you for sharing this tip.  I believe that the HTML= option was available in earlier releases as well - perhaps as beta (?).  BTW there is a missing semi-colon on the second comment in the first DATA step.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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