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?
proc lifetest data=lungcancer plots=survival(atrisk);
time survival*status(0);
strata age / test=logrank;
run;
Hello @nic_perry ,
@nic_perry wrote:
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?
So, you want all ages in the LIFETEST analysis but only the ages up till 60 (included) in the survival probability plot, correct?
In that case, capture all results in an output dataset and plot that output dataset with PROC SGPLOT and a where clause :
where age <= 60 ;
And with regard to grouping into age categories ...
Same question : is this grouping only meant for plotting or also for the preceding analysis?
data work.want;
set work.have;
if 10 <= age < 20 then ageclass='10';
else if 20 <= age < 30 then ageclass='20';
...
else if 90 <= age < 150 then ageclass='90';
else ageclass='00';
run;
Thanks,
Koen
@nic_perry wrote:
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?
proc lifetest data=lungcancer plots=survival(atrisk); time survival*status(0); strata age / test=logrank; run;
Are you just asking to change the set of STRATA you ask it to use?
Are there implications about censoring if you truncate AGE at 60? In other words if there is a data point with an age of 65 and a survival of 10 years does that mean that 5 of those years was after age 60? Do you want to censor that survival time to just the 5 years to correspond to truncating the age at 60?
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!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: