data sample;
length patient $8. milestone $75. ;
infile cards dlm=",";
input patient $ milestone $ day;
cards;
Patient1,Treatment discontinuation due to lack of efficacy,7
Patient2, ,15
Patient3,Study discontinuation,5
Patient4,Rescue medication,10
Patient5,Death,4
Patient6,Treatment discontinuation due adverse events,12
Patient7,Study discontinuation,8
;
run;
Hi There,
Please find the snippet.
I am currently using SAS 9.4 and SAS studio software.
I want to create a similar graph of patient data but with the animation.
Meaning, when I opened that file it should start animate from the first patient to last patient with the milestones (data showed with different symbols in the graph). I also would like to see the animation from left to right.
Hence kindly let me know, will that be possible to do with the SAS 9.4/SAS Studio. If Yes, kindly let me know how to do that using graphical procedures in SAS.
Kindly let me know if my requirement is not clear so that I can elaborate furthermore.
The attached graph was not created using the below data and I am not sure which software they have used to create that.
I just want to create the same layout with the required animation using the below data. In the X-axis I would like to see the Day values.
Thanks in advance 😊.
Best,
Hari
I suggest you proceed in three steps.
1. Learn how to create the graph for one patient ID. This graph is sometimes called a "swimmer's plot";
2. Use a BY statement to create a sequence of plots, one for each patient ID.
3. Use the tips in the article "Create an animation with the BY statement in PROC SGPLOT" to create the animation.
The link I provided (the third step) shows how to create an animation from the BY-group analysis.
@Hari6 wrote:
Hi Rick_SAS,
Thank you for your email.
I will just explore that one and get back to you if still unable to do that.
Could you please tell me is that possible to create the exact layout with
animation which i have pasted in my previous post without any limitations
using SAS?
Thanks in advance 🙂
Kind regards,
Hari
I think that you should define exactly what you mean by "without any limitations".
The more complex a result then typically the more complex a program. So there may well be limitations based on the programmers ability. Or the content of the data.
Your picture has a lot of different elements without any reference to what values or rules are involved in creating/displaying them. You may have to provide image files or know an appropriate Unicode character depending on approaches to placing some of those graphic elements.
I agree with ballardw. It is possible to visualize the INFORMATION that the graph shows, but using a lightning bolt and other images might require more work.
Good luck in your project. In my opinion, a static graph that includes all patients is usually more informative and useful that an animated version. I encourage you to discuss this project with your supervisor and discuss whether an animated graph is really the best way to visualize these data.
Hi Rick,
Thanks for your reply.
Having a static graph that includes all patients is usually more informative and this is absolutely correct.
However people are looking for the fancy graphs and that's how the request has come.
I will try using all the possible way to create it (Using GTL and SGplot with by statement).
Best,
Hari
It is not clear what is the variable that is driving the animation. Do you want build from one patient to two patients etc?
Or do you want show snapshot of what data was collected over time? So first image might have just two patients with short "bars" and then the number of patients and the lengths of the bars increase as time moves forward.
I assume you want to animate the graph over time(?)
You mention that you don't want to use a by statement because "BY statement separates each patient into different graph". But that only happens if you use "by patient". You'll want to create a special dataset where it has a snapshot of the data at each time increment you desire in your animation, and then use "by time_increment" (rather than by patient). An alternative to using "by time_increment" would be to use a data step to look through the desired dates, and call a macro which subsets (or creates) the desired dataset & plot for that date. I would prefer using this macro technique, but I guess it depends on whether or not you're comfortable writing macros.
Hi Robert,
Thank for your response on this.
As mentioned If i use the time instead of the Patient in BY variable the Graph will show that data of all Patients till that time point. However As per the requirement they'll only want to see Patient wise data instead time meaning what happened to that each individual Patient through out the study and similarly for all patients. I think this animation by Patient can be done using SAS Visual analytics? can i know your thought on this?
Bets,
Hari
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.