11
$\begingroup$

I have fitted a Cox ph model using both R 4.3.1 and SAS 9.4 with the same data. In SAS, I used Proc phreg, while coxph function in Survival package, the model formula are totally the same, but I got different results (e.g., coefficients), what's the reason? And I wanan know how to modify my SAS program to get the same results as R, or modify my R code to get the same results as SAS.

Here is my data:

ID  Group    Time  Status WBC   CWBC    Gender
1   Treatment   6   1   2.31    Medium  0
2   Treatment   6   1   4.06    High    1
3   Treatment   6   1   3.28    High    0
4   Treatment   7   1   4.43    High    0
5   Treatment   10  1   2.96    Medium  0
6   Treatment   13  1   2.88    Medium  0
7   Treatment   16  1   3.6     High    1
8   Treatment   22  1   2.32    Medium  1
9   Treatment   23  1   2.57    Medium  1
10  Treatment   6   0   3.2     High    0
11  Treatment   9   0   2.8     Medium  0
12  Treatment   10  0   2.7     Medium  0
13  Treatment   11  0   2.6     Medium  0
14  Treatment   17  0   2.16    Low     0
15  Treatment   19  0   2.05    Low     0
16  Treatment   20  0   2.01    Low     1
17  Treatment   25  0   1.78    Low     1
18  Treatment   32  0   2.2     Low     1
19  Treatment   32  0   2.53    Medium  1
20  Treatment   34  0   1.47    Low     1
21  Treatment   35  0   1.45    Low     1
22  Placebo     1   1   2.8     Medium  1
23  Placebo     1   1   5       High    1
24  Placebo     2   1   4.91    High    1
25  Placebo     2   1   4.48    High    1
26  Placebo     3   1   4.01    High    1
27  Placebo     4   1   4.36    High    1
28  Placebo     4   1   2.42    Medium  1
29  Placebo     5   1   3.49    High    1
30  Placebo     5   1   3.97    High    0
31  Placebo     8   1   3.52    High    0
32  Placebo     8   1   3.05    High    0
33  Placebo     8   1   2.32    Medium  0
34  Placebo     8   1   3.26    High    1
35  Placebo     11  1   3.49    High    0
36  Placebo     11  1   2.12    Low     0
37  Placebo     12  1   1.5     Low     0
38  Placebo     12  1   3.06    High    0
39  Placebo     15  1   2.3     Medium  0
40  Placebo     17  1   2.95    Medium  0
41  Placebo     22  1   2.73    Medium  0
42  Placebo     23  1   1.97    Low     1

Time: Survival time

Status: 0 represents censorship

WBC: a continuous covariate

Here is my SAS program:

proc phreg data=mydata;
    class group(ref="Placebo");
    model time*status(0) = group wbc;
run;

And here is my R program:

library(survival)
library(survminer)
fit <- coxph(Surv(Time,Status)~Group+WBC,data=mydata)

Outputs:*

SAS gives

enter image description here

and R gives

enter image description here

Anyone can help? Thanks a lot!

$\endgroup$
1
  • $\begingroup$ Great! My issue has been completely resolved, greatly appreciate assistance from PBulls. $\endgroup$
    – Calio Xu
    Mar 20 at 14:55

1 Answer 1

20
$\begingroup$

The following bits from the documentation of each software will prove informative (highlights mine):

For PROC PHREG:

TIES specifies how to handle ties in the failure time. The following methods are available:
BRESLOW uses the approximate likelihood of Breslow (1974). This is the default value.

For coxph:

ties a character string specifying the method for tie handling. If there are no tied death times all the methods are equivalent. The Efron approximation is used as the default [..]

If you align these you'll see that you get identical results.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.