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.
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.
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.