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)
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
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).
@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)
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
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 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
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
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.