Home  /  Resources & support  /  FAQs  /  Cox regression results in Stata versus SAS

Why do the results for cox and stcox not match SAS PHREG?

Title   Cox regression results in Stata versus SAS
Authors William Gould, StataCorp
James Hardin, StataCorp
Date November 1996

It all comes down to ordering different events that occur at the same time. At each death time, Stata orders the events as
  1. death occurs
  2. censoring occurs
  3. people enter
SAS PHREG orders those events as
  1. censoring occurs
  2. death occurs
  3. people enter
So, the difference only occurs when some subjects are censored and others die at the same value of the time variable. Because of the ordering, Stata considers that subjects that are censored at time t are available to die at time t (thus they are in the risk pool). SAS PHREG does not.

If you would like to match results from SAS PHREG, add a small number to the time variable for the deaths (so that Stata will censor the values and remove them from the risk pools for the deaths).

Who is right?

Neither. The fault lies with whomever collected the data. Time is continuous and the data was not collected at a fine enough resolution. When your dataset does not differentiate the order that events occur, you leave it to the software to decide for you. This is not a good idea in general.