I have a data set with 152 observations. Each obs is a lab result and there are about 40 unique patients in the data set. Obviously some will have more results than other. The goal is to monitor the fluctuation of their results over time. What I want to do is be able to have the output in an HTML format so that I can use Tool Tips to identify the name of the patient when looking at outliers and drastic increases. The variable that I want to show when I hover the cursor over the graph is named "last" as in last name. The code thus far, which produces the graph I want in attached, Now i just need to add the Tool Tip Boxes. Please Help.
ods _all_ close;
options orientation=landscape;
ods html path="c:\users\rgclevenger\desktop" (url=none) file="test.html" ;
ods graphics on;
proc gplot data=work.graph ;
plot results*diff=first / grid nolegend;
by discharged ;
run;
ods html close;
ods listing;
The data will look something like:
Last First diff results discharged
smith Jack 3 month 10008 enrolled
smith Jack 6 month 204 enrolled
smith Jack 9 month 20 enrolled
doe John 3 month 270000 Discharged
doe John 6 month 782 Discharged
What Could it take to have the Last name pop up as tool tip text?
What would it take to have the First Initial and last name as tool tip text?
So, I found out that the way to plot ALL patients while providing a different colors for specific groups of patients is to use a spaghetti plot using the series x= y= / group= grouplc= grouplp= name= smoothconnect= tip=( ) statement in a proc sgplot. The tip= option provides the tool tip text that I want given the the statement "ods graphics / imagemap = on" is above the procedure statement.
In the data step that creates work.graph, you need to create a character variable that has the desired HTML code, lets call this variable name simple TEXT.
text=cat("title='",last,' ',substr(first,1,1),'");
Then in your PROC GPLOT you need to modify the PLOT statement to be
plot results*diff=first / grid nolegend html=text;
Just for my information, why does specifying html=last not work? If the Variable is character and already exists wouldn't it produce the same thing?
Just for my information, why does specifying html=last not work?
Variable LAST does not contain HTML code.
Minor correction to my code
text=cat("title='",last,' ',substr(first,1,1),"'");
ALSO... I definitely was able to create a variable with exactly what I could like to appear but it is no different when I specify that Variable or another other Variable in the HTML= option. Nothing is appearing in the graph area as tool tip text. There must me something else that I am not doing.
So, I found out that the way to plot ALL patients while providing a different colors for specific groups of patients is to use a spaghetti plot using the series x= y= / group= grouplc= grouplp= name= smoothconnect= tip=( ) statement in a proc sgplot. The tip= option provides the tool tip text that I want given the the statement "ods graphics / imagemap = on" is above the procedure statement.
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.
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.