BookmarkSubscribeRSS Feed
Hari6
Calcite | Level 5

Graph_sample.JPG

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

10 REPLIES 10
Rick_SAS
SAS Super FREQ

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.

 

Hari6
Calcite | Level 5
Hi,

I am aware of how to create a graph of different types.

However here my requirement is different than the routine one. Using BY
statement in PROC SGPLOT we can create a animated plot which i am aware.
However in this requirement i want to see the animation for all the
patients in the same graph in sigle shot without using BY statement as
this BY statement separates each patient into different graphs with the
animation.

Kindly lett me know if any documents are there to refer.
Rick_SAS
SAS Super FREQ

The link I provided (the third step) shows how to create an animation from the BY-group analysis.

Hari6
Calcite | Level 5
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
ballardw
Super User

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

Rick_SAS
SAS Super FREQ

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.

 

Hari6
Calcite | Level 5

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

Tom
Super User Tom
Super User

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.

GraphGuy
Meteorite | Level 14

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.

 

Hari6
Calcite | Level 5

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 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 10 replies
  • 1329 views
  • 3 likes
  • 5 in conversation