BookmarkSubscribeRSS Feed
Denali
Quartz | Level 8

Hi,

 

I would like to produce a timeline plot using the below dates. Could anyone please help me with the coding? Thank you so much!

 

ID Drug_A Drug_B Drug_C Drug_D Date of Disease Diagnosis Date of Hospitalization Drug_E Given Date Recovery Date of Death Date of Discharge
38015709 4/9/2020   4/21/2020 4/10/2020 4/2/2020 4/8/2020 4/17/2020 4/22/2020   4/29/2020
38002849 4/15/2020   4/17/2020   4/15/2020 4/15/2020 4/20/2020 4/24/2020 4/27/2020 4/27/2020
38085888 4/10/2020       4/7/2020 4/10/2020 4/17/2020 4/25/2020   4/29/2020
35580777         4/4/2020 4/19/2020 4/25/2020 4/26/2020   4/26/2020
35666671         4/8/2020 4/8/2020 4/23/2020 4/26/2020   4/30/2020
35452169         4/7/2020 4/25/2020 4/26/2020 4/27/2020   4/27/2020
35522178 4/21/2020       4/17/2020 4/21/2020 4/24/2020 4/28/2020   4/28/2020
38033034         4/20/2020 4/24/2020 4/26/2020 4/28/2020   4/28/2020
35406667         4/15/2020 4/15/2020 4/21/2020 4/28/2020   4/29/2020
35222190         4/9/2020 4/10/2020 4/17/2020 4/28/2020   4/28/2020
10 REPLIES 10
PaigeMiller
Diamond | Level 26

Explain further about this plot that you want.

 

What variable is the x-axis? What variable is the y-axis? What does the plot look like? Can you show us an example somewhere on the internet?

--
Paige Miller
Denali
Quartz | Level 8

Hi,

 

I would like to visualize patient's date of hospitalization, usage of drug (Drug A-E) and the dates when they died or discharged from the hospital end points.

 

I also have a smoking variable that I want to use as group comparison (smoker vs. non-smoker). Sorry I forgot to post this variable in the first posting. 

 

Please see the following link as an example: https://www.nejm.org/doi/full/10.1056/NEJMoa2007016

 

If you cannot see the contents in the website, please dowland the attached Excel file.

ballardw
Super User

Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the </> icon or attached as text to show exactly what you have and that we can test code against.

 

I doubt anyone is going to attempt to type your data.

And I really hope your dates are actually SAS date values.

PaigeMiller
Diamond | Level 26

People will not download an Excel file. This is a security risk. Paste the plot you want to show us into your message by using the "insert Photos" icon.

 

As far as the link, which of the plots in that paper are the one you want?

--
Paige Miller
Denali
Quartz | Level 8

Hi,

 

Here is the sample graph that I would like to generate:

Sample.JPG

PaigeMiller
Diamond | Level 26

Perhaps you can use the code for Figure 4 in this document: https://www.lexjansen.com/phuse/2016/dv/DV04.pdf

--
Paige Miller
Denali
Quartz | Level 8

Hi @PaigeMiller ,

I was going to use the code under Figure 4 that you posted, but I noticed the data (shown in Figure 5) is much cleaner than mine. 

My time zero is "Date of Disease Diagnosis", and my primary interest is the treatment date for Drug E. But Drug A-D could be given before and after Drug E. I am not sure how to insert the dates of receiving Drug A-D into the figure. Should I calculate the time between Drug E and other drugs?

PaigeMiller
Diamond | Level 26

As I don't do statistical analysis of medical studies, I'm really not the person to ask here. You may want to discuss this with others in your field who might have more experience.

--
Paige Miller
Denali
Quartz | Level 8

@PaigeMiller I checked but nobody has done it in SAS before. Thank you for your help. 

PaigeMiller
Diamond | Level 26

@Denali wrote:

@PaigeMiller I checked but nobody has done it in SAS before. Thank you for your help. 


I think you have misunderstood my point. This is no longer a SAS question, this is a subject matter question. You need to decide what to do about missing medications, whether you want them in the plot or not, and what it should look like on the plot; and this needs to be decided based upon the needs of the study.

 

Once that decision is made about what you want to do, then we can come back and discuss how it might get done in SAS.

--
Paige Miller

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 10 replies
  • 1488 views
  • 1 like
  • 3 in conversation