BookmarkSubscribeRSS Feed
blackandwhite
Obsidian | Level 7

Hi,

 

I am trying to create a plot of the cumulative hazard of an outcome over time for a time-varying exposure using the Nelson-Aalen estimator in SAS.

 

The figure should look something like the Figure 1 attached here. I also need to know the breakdown of the risk set, no events etc. at each time point.

 

The graph with additional details are in this article:

Munoz-Price LS, Frencken JF, Tarima S, Bonten M. Handling Time-dependent Variables: Antibiotics and Antibiotic Resistance. Clin Infect Dis 2016;62:1558-1563.

 

Any advice would be really appreciated.

Thanks you.

5 REPLIES 5
Reeza
Super User

@blackandwhite wrote:

Hi,

 

I am trying to create a plot of the cumulative hazard of an outcome over time for a time-varying exposure using the Nelson-Aalen estimator in SAS.

 

The figure should look something like the Figure 1 attached here. I also need to know the breakdown of the risk set, no events etc. at each time point.

 

The graph with additional details are in this article:

Munoz-Price LS, Frencken JF, Tarima S, Bonten M. Handling Time-dependent Variables: Antibiotics and Antibiotic Resistance. Clin Infect Dis 2016;62:1558-1563.

 

Any advice would be really appreciated.

Thanks you.


Ok, which part are you having problems with? You haven't provided data or anything so it's a bit hard to comment, but I'm going to guess you want a PROC PHREG to start out with. 

 

Here's the documentation reference:

https://documentation.sas.com/?docsetId=statug&docsetTarget=statug_phreg_examples06.htm&docsetVersio...

 

That should get you started.

Reeza
Super User

After reviewing the paper, actually, this is only PROC LIFETEST that you need, which is much simpler. 

You can specify NELSON on the PROC LIFETEST statement. 

Unfortunately I don't see an easy way to get the plots of those estimates. 

 

PROC LIFETEST documentation:

https://documentation.sas.com/?docsetId=statug&docsetTarget=statug_lifetest_syntax01.htm&docsetVersi...

 

Here's a tutorial on getting the estimates, saving them to a data set and plotting it 'manually' using SGPLOT. You'll just have to change the column references. 

https://blogs.sas.com/content/graphicallyspeaking/2018/02/19/survival-plot-twist-using-sgplot-proced...

 

The full code is at the bottom of the post. I would suggest running the example and then doing yours step by step to convert the code to work with your data. 

 

EDIT: added reference to PROC LIFETEST

 


@blackandwhite wrote:

Hi,

 

I am trying to create a plot of the cumulative hazard of an outcome over time for a time-varying exposure using the Nelson-Aalen estimator in SAS.

 

The figure should look something like the Figure 1 attached here. I also need to know the breakdown of the risk set, no events etc. at each time point.

 

The graph with additional details are in this article:

Munoz-Price LS, Frencken JF, Tarima S, Bonten M. Handling Time-dependent Variables: Antibiotics and Antibiotic Resistance. Clin Infect Dis 2016;62:1558-1563.

 

Any advice would be really appreciated.

Thanks you.


 

blackandwhite
Obsidian | Level 7

Hi and thanks for your answer.

Proc lifetest only works for dataset structured with a row per patient ID, not when it is in counting process, which is necessary to accommodate a time-varying exposure.

Perhaps I misunderstood your answer?

Reeza
Super User

I'm basing this on the methods used in the paper, which seem to be just PROC LIFETEST. 

If you have a different methodology than the paper, then you do need to explain your methodology and provide some reference for the calculation. 

 

PROC PRHEG will handle time-dependent so that may be the option that works for you.

 

It's been a few days, so the details are not fresh in my mind anymore.  

 

 

blackandwhite
Obsidian | Level 7

Proc phreg won't work to plot a NA curve for a TD variable, neither proc lifetest.

I had already looked into it

 

 

 

 

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
  • 5 replies
  • 2292 views
  • 0 likes
  • 2 in conversation