When I run proc lifetest, nearly all of my observations are deleted with the following message, "169 observations with invalid time, censoring, or strata values were deleted." I can't figure out why it's doing this. Below is my data after I create the censoring variable from the code I pasted below. I apologize if it's long, but I figured you want to see the whole thing. This survival analysis is supposed to model recurrence of breast cancer where LastFUStatus1 can = 4 meaning Alive, with recurrence and everything else does != alive with recurrence. DateFirstRecur1 is self-explanatory, it is the date the patient had their first recurrence of their cancer. Insurance status ( 0 = uninsured, 1 = insured):
. | 1 | 2 | . | 0 |
. | 0 | . | . | 0 |
24 | 1 | 4 | 20JUN2016:00:00:00 | 1 |
. | 1 | 2 | . | 0 |
. | 0 | . | . | 0 |
. | 1 | 1 | . | 0 |
16 | 0 | 7 | 06SEP2013:00:00:00 | 1 |
. | 1 | 2 | . | 0 |
. | 0 | . | . | 0 |
. | 1 | 2 | . | 0 |
. | 0 | 2 | . | 0 |
. | 1 | . | . | 0 |
. | 0 | . | . | 0 |
29 | 1 | 4 | 25FEB2013:00:00:00 | 1 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 7 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 0 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | . | . | 0 |
. | 0 | . | . | 0 |
. | 0 | . | . | 0 |
. | 0 | . | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | . | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 1 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | . | . | 0 |
. | 1 | 2 | . | 0 |
7 | 1 | . | 10NOV2008:00:00:00 | 1 |
. | 0 | . | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | . | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 0 | . | . | 0 |
18 | 1 | 2 | 19NOV2014:00:00:00 | 1 |
11 | 1 | 4 | 11MAY2010:00:00:00 | 1 |
. | 1 | 2 | . | 0 |
48 | 1 | 8 | 08APR2013:00:00:00 | 1 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
47 | 1 | 2 | 23FEB2011:00:00:00 | 1 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 0 | . | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | . | . | 0 |
13 | 1 | 1 | 13NOV2009:00:00:00 | 1 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | . | . | 0 |
. | 1 | . | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 0 | . | . | 0 |
. | 1 | . | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | . | . | 0 |
. | 0 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | . | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | . | . | 0 |
. | 1 | 8 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
101 | 1 | 8 | 23MAR2010:00:00:00 | 1 |
. | 0 | 2 | . | 0 |
. | 1 | . | . | 0 |
. | 1 | . | . | 0 |
. | 1 | 2 | . | 0 |
. | 0 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 0 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 5 | . | 0 |
. | 0 | . | . | 0 |
11 | 1 | 8 | 05MAY2016:00:00:00 | 1 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 0 | . | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | . | . | 0 |
. | 1 | . | . | 0 |
. | 0 | . | . | 0 |
. | 1 | 8 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | . | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 1 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | . | . | 0 |
1 | 1 | . | 06MAR2001:00:00:00 | 1 |
. | 1 | . | . | 0 |
. | 1 | 2 | . | 0 |
39 | 1 | 8 | 23JAN2015:00:00:00 | 1 |
. | 0 | 2 | . | 0 |
. | 1 | 8 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
40 | 1 | 2 | 16OCT2012:00:00:00 | 1 |
. | 0 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 0 | . | . | 0 |
12 | 1 | . | 21MAR2007:00:00:00 | 1 |
12 | 1 | . | 21MAR2007:00:00:00 | 1 |
. | 1 | 2 | . | 0 |
. | 0 | . | . | 0 |
. | 1 | . | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 0 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | . | . | 0 |
. | 1 | 1 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | . | . | 0 |
24 | 1 | 7 | 02DEC2004:00:00:00 | 1 |
20 | 1 | 7 | 14NOV2012:00:00:00 | 1 |
. | 1 | . | . | 0 |
. | 1 | 2 | . | 0 |
66 | 1 | 4 | 04MAR2016:00:00:00 | 1 |
. | 1 | 1 | . | 0 |
. | 1 | . | . | 0 |
. | 0 | . | . | 0 |
33 | 1 | 8 | 04NOV2011:00:00:00 | 1 |
. | 1 | 2 | . | 0 |
. | 1 | . | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | . | . | 0 |
. | 1 | . | . | 0 |
. | 1 | . | . | 0 |
. | 0 | . | . | 0 |
. | 1 | 2 | . | 0 |
. | 0 | . | . | 0 |
13 | 1 | . | 02APR2002:00:00:00 | 1 |
. | 0 | 1 | . | 0 |
. | 1 | . | . | 0 |
. | 1 | 2 | . | 0 |
39 | 1 | 8 | 30NOV2010:00:00:00 | 1 |
. | 0 | . | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 0 | . | . | 0 |
. | 0 | 5 | . | 0 |
. | 1 | 2 | . | 0 |
. | 1 | 2 | . | 0 |
. | 0 | . | . | 0 |
And here is my code:
DATA disease_interval; SET trends_temp5; months = intck("dtmonth", DateOfInitDx1, DateFirstRecur1); put months =; IF LastFUStatus1 = 4 or not missing(DateFirstRecur1) then censored_disease = 1; ELSE IF LastFUStatus1 ne 4 or missing(DateFirstRecur1) then censored_disease = 0; *Delete ****** due to inconsistent data; IF Lname = "HO*****" and Fname = "K******" then DELETE; LABEL months = "Duration in Months"; RUN; PROC LIFETEST DATA = disease_interval plots = survival(cb=hw test atrisk(outside(0.10))) graphics; FORMAT InsuranceStatus1 InsuranceType.; strata InsuranceStatus1; time months*censored_disease(0); symbol1 v=none; RUN;
21 | 21 | 0 | 0.00 |
1 | 1 | 0 | 0.00 |
22 | 22 | 0 | 0.00 |
Note: | 169 observations with invalid time, censoring, or strata values were deleted. |
@lady8506 wrote:
So it appears the records were deleted due to missing their date of first recurrence.
The censored cases do not miss a date of first recurrence because apparently they did not have a recurrence. But nevertheless variable months needs to contain valid values for these cases, too. From your definition I guessed this should be the number of months from DateOfInitDx1 to the date when they were censored. So, the final definition of months might have the form
months = intck("dtmonth", DateOfInitDx1, coalesce(DateFirstRecur1, DateOfLastFU));
where DateOfLastFU contains the datetime values of the last follow-up visit or whatever the censoring datetime is in your data. For missing values of DateFirstRecur1 the COALESCE function would return the value of DateOfLastFU (assuming that only the censored cases have missing DateFirstRecur1).
@lady8506 wrote:
When I run proc lifetest, nearly all of my observations are deleted with the following message, "169 observations with invalid time, censoring, or strata values were deleted." I can't figure out why it's doing this. (...)
months = intck("dtmonth", DateOfInitDx1, DateFirstRecur1); (...) PROC LIFETEST DATA = disease_interval ...; strata InsuranceStatus1; time months*censored_disease(0);
Hello @lady8506,
Just look through the three types of values mentioned in the log message:
So, the issue is that you didn't supply valid time values for the censored cases. I guess these should be the number of months from DateOfInitDx1 to the censoring date.
Thank you Freelance. So it appears the records were deleted due to missing their date of first recurrence. Hmmm. Is there a way to get them back into the analysis or is that not an option?
@lady8506 wrote:
So it appears the records were deleted due to missing their date of first recurrence.
The censored cases do not miss a date of first recurrence because apparently they did not have a recurrence. But nevertheless variable months needs to contain valid values for these cases, too. From your definition I guessed this should be the number of months from DateOfInitDx1 to the date when they were censored. So, the final definition of months might have the form
months = intck("dtmonth", DateOfInitDx1, coalesce(DateFirstRecur1, DateOfLastFU));
where DateOfLastFU contains the datetime values of the last follow-up visit or whatever the censoring datetime is in your data. For missing values of DateFirstRecur1 the COALESCE function would return the value of DateOfLastFU (assuming that only the censored cases have missing DateFirstRecur1).
Thank you for your help!
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!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.