'How to adjust variable for Survival Analysis in SAS
Im running a survival analysis and I have a variable 'age' where the data ranges from 30-90 years old but how do I cut it off and make it so the survival probability graph will only include up to the age of 60? Also how might I group them in categories of say 30-50 years, 50-70 years, and 70-90 years?
This is my code so far:
proc lifetest data=lungcancer plots=survival(atrisk);
time survival*status(0);
strata age / test=logrank;
run;
Solution 1:[1]
So, a quick disclaimer - I haven't used PROC LIFETEST, and don't have access to a SAS environment right now. Regardless, I think this might point you in the right direction.
how do I cut it off and make it so the survival probability graph will only include up to the age of 60?
You could use the WHERE= Data Set Option: https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000131192.htm
Your PROC step would look something like this:
proc lifetest data=lungcancer(where=(age<=60)) plots=survival(atrisk);
time survival*status(0);
strata age / test=logrank;
run;
Also how might I group them in categories of say 30-50 years, 50-70 years, and 70-90 years?
The STRATA statement in PROC LIFETEST might resolve your issue: https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_lifetest_sect008.htm
Or, perhaps, the BY statement: https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_lifetest_sect005.htm
Hopefully this is some help.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Mikkel |
