BookmarkSubscribeRSS Feed
petax004
Calcite | Level 5

Hello,

 

This is my first time doing survival analysis and I tried different intro to cox proportional hazard regression SAS tutorial papers but still I'm not sure if I'm doing this right with the syntax.

 

Attached table is a sample of data I'm working on and the analysis is to track patients from 01/01/2018 to first time they get ESA use (flagged as 1) and date is captured in esa_date and objective is to use the explanatory variables and Identify which variables can predict ESA use and get the hazard ratios. A patient can get censored because they died, lost in the follow-up, or gaps in coverage (like patient E who lost coverage for some period but have ESA use when they got back on coverage - here is used the lost date to calculate time, please let me know if this is not right)

 

sample table.png

 

Do I have the right syntax to get what I want, which is explanatory variables hazard ratios for ESA use?

Personally, I don't know why my outcome of interest esa_use should be specified as explanatory variable.

 

proc phreg data=sample;
class gender (ref="M") esa_use (ref="0") anemia (ref="0")
model time*lost_flag(0)=age gender esa_use anemia_t;
anemia_t=anemia*log(time);
run;

Thanks in advance

7 REPLIES 7
Reeza
Super User

ESA_USE should not be used as a variable in your model, not sure why you think it should be included.

 

I'm assuming you've determined anemia already violates the PH assumption, thus the requirement for a time dependent variable?

 


proc phreg data=sample plots=(survival);
class gender (ref="M")  anemia (ref="0") / param = REF;
model time*lost_flag(0)=age gender anemia_t;
anemia_t=anemia*log(time);
hazardratio gender;
run;

You may also want to use the HAZARDRATIO statement explicitly to examine the HR at different combinations. It's worth looking into the BASELINE statement/options as well, Example 89.8 Survival Curves shows how to use the statement if you need an example (see the full code link at the top of the example page). 

 

https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.4&docsetId=statug&docsetTarget=statu...

 


@petax004 wrote:

Hello,

 

This is my first time doing survival analysis and I tried different intro to cox proportional hazard regression SAS tutorial papers but still I'm not sure if I'm doing this right with the syntax.

 

Attached table is a sample of data I'm working on and the analysis is to track patients from 01/01/2018 to first time they get ESA use (flagged as 1) and date is captured in esa_date and objective is to use the explanatory variables and Identify which variables can predict ESA use and get the hazard ratios. A patient can get censored because they died, lost in the follow-up, or gaps in coverage (like patient E who lost coverage for some period but have ESA use when they got back on coverage - here is used the lost date to calculate time, please let me know if this is not right)

 

sample table.png

 

Do I have the right syntax to get what I want, which is explanatory variables hazard ratios for ESA use?

Personally, I don't know why my outcome of interest esa_use should be specified as explanatory variable.

 

proc phreg data=sample;
class gender (ref="M") esa_use (ref="0") anemia (ref="0")
model time*lost_flag(0)=age gender esa_use anemia_t;
anemia_t=anemia*log(time);
run;

Thanks in advance


 

petax004
Calcite | Level 5

Thanks for replying @Reeza 

 

The time value for patient A is the duration to first ESA use and for patient B it's total number of days from start to end of the study period because the patient doesn't have ESA use and no lost to follow-up so, I thought I've to specify to ESA_USE so regression would know the difference - if you can provide some details on why it shouldn't be used and if we don't use it, how the regression would know the difference between patient A and B time value would be good education for me.

 

I've not tested whether anemia violates the PH assumptions as it was already defined as time-dependent variable from prior knowledge gathered from literature and clinical reasoning. This is the literature I'm trying to replicate Predictors of ESA use in the non-dialysis chronic kidney disease population with anemia - PubMed (ni... and the sample data I showed is just to show the structure of the data.

 

Your reply is helpful 🙂

 

Reeza
Super User
You don't use it because that information is also contained in the Time and Censor variables, which is why you need both of those. Your event of interest is defined as time to ESA Usage but not everyone develops it or is censored.

So in the traditional survival models, say for cancer, your outcome would be death and those that didn't die are censored and the time to death or censor is used but you wouldn't also include dead in the explanatory variables. Have you worked through the examples in the documentation?

You can verify the PH assumption for your data using the ASSESS statement.
petax004
Calcite | Level 5

@Reeza I'm still not sure which part of the syntax would let SAS know the 365 days in time variable for patient B shouldn't be read as the days to ESA because the lost_flag=0 and I don't have esa_use in the dependent variable to provide that information. 

 

Sorry for not grasping your answer, hope you would reply to this message. Thanks

Reeza
Super User
Your censor flag should indicate that information. It provides the information that the person went at least 365 days without starting to use ESA.
petax004
Calcite | Level 5

Thank you!

Following documentation helped: https://www.sas.com/content/dam/SAS/en_ca/User%20Group%20Presentations/Edmonton-User-Group/NiroshaGu...

I created a new column called censor and flagged "1" if the patient has lost_flag=1, "2" if the patient doesn't have ESA use but lost_flag=0 and everything is "0"

 

In the SAS code, replaced the time*lost_flag(0) with time*censor(1,2).

 

Please let me know if this a right approach. Thanks

 

 

Reeza
Super User
lol, that's one of my former interns presentation.

That looks right to me.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 1713 views
  • 1 like
  • 2 in conversation