Programming the statistical procedures from SAS

kaplan meier

Posts: 45

kaplan meier

subj            drug                week              q1

1                 a                       16                  0

2                 b                        5                  0

3                 a                        4                  0

4                 c                       16                  1

5                 a                        3                  0

6                 e                       16                  .


I would like to do a kaplan meier analysis (median time to responding?) on this data set where i want to find how long does it take subjects to reach q1=0 by each drug type. Note: I do have missing q1 (not sure what to do with those either)...


I was thinking this is the code, but I am not sure:

proc lifetest data=mine (where=(q1=1 or q1=0)) method=km plots=survival;

strata drug;

time week*q1(0);


SAS Employee
Posts: 105

Re: kaplan meier

[ Edited ]

Hi, Starz.


I think your code has 0 as the censored value when you really want it as your event value since you are estimating time to transition from 1 to 0.


For the observation with the missing value, does the missing value indicate that you don't know its status (0 vs. 1) at 16 weeks? I'm wondering if it is really a censored observation (i.e., a 1) in disguise. If you really don't know its status at 16 weeks, can you find out its status at 15 weeks, etc.? Methods like KM allow you to use as much information as you have about each observation, even if they dropped out before the study period ended, and therefore save you from discarding observations unnecessarily.




(edited to fix a typo)

Posts: 45

Re: kaplan meier

so to ask a question to your are missing values assessed in this type of analyis? is a missing value treated the same way as a not censored value. I do know for a fact that if at Week 16 the value was ., then there is no way that at Week 15 or any week prior would be "1" (as you describle as the correct censored value). But there is a possiblility that at Week 15 or any week prior that the subject can be a "0".

SAS Employee
Posts: 105

Re: kaplan meier



Proc Lifetest excludes any observations with missing time or event status variables. (There is an option to include missing strata values but that doesn't seem to be an issue for you.)


In a typical (let's say 'basic') survival study, all subjects start with status=nonevent. Some transition to status=event during the observation period. The rest are censored (event may have occurred but you don't know when).


If a subject with a missing value at  week 16 could not have had a 1 at any time prior, doesn't that mean they start the study already experiencing the event? 


Or are there multiple states in your study (event and more than one type of nonevent)? 


Sorry if I'm confused. 

Posts: 45

Re: kaplan meier

Hi, Thank you for the response.


So I want to see when (how quickly) the subject clears (q1=1) a symptom (q1). So my subjects start at q1=0, in which they are experiencing the symptom. And somwhere throughout the 16 weeks they will reach q1=1 (clear) or they will not (either because week 16 is missing (dropout or symptom occurence wasn't collected) or they still have q1=0 (still have symptom) by Week 16).


So my censored value is (1)?


Hopefully that explanation makes a bit more sense...

Ask a Question
Discussion stats
  • 4 replies
  • 2 in conversation