I want to get the same results of implementing cox-box by R for this SAS code,

model (time1, time2) * event(0, 2) = Age / rl;                                     

id ID;

by Imputation;

ods output ParameterEstimates=param;

output out=obs xbeta=score_beta;


I would like to ask how I can perform the cox-model in R and taking into account two group variables, the variable ID and the Imputation variable in the below data.

Frankly, I did this by cph() and coxph() functions and I got different results thans SAS.

f = cph(Surv(time1, time2, event%in%c(1,2))~ Age,  data = dat, x=T, y=T, na.action=na.omit, surv=TRUE, stratum(ID), cluster(Imputation) )

f = coxph(Surv(time1, time2, event%in%c(1,2))~ Age, data = dat, id = ID, cluster(Imputation))

is it true? the reference event is 0. Thanks in advance.

enter image description here

  • $\begingroup$ Please edit your question to say more about what you are trying to accomplish with the ID and Imputation terms. You have counting-process data, but have two different sets of such data for the same ID Then your Imputation values cut across the ID values instead of grouping together multiple ID values, which is what cluster() terms typically do. Provide more information about the goals of this analysis; it's not clear that these models will accomplish what you have in mind. $\endgroup$
    – EdM
    Oct 11 at 19:08
  • $\begingroup$ I corrected that really. $\endgroup$
    – Rani
    Oct 12 at 10:40
  • 1
    $\begingroup$ You still provided no background information or goals. $\endgroup$ Oct 12 at 11:59
  • $\begingroup$ There is still no information on the scientific question that you are addressing. I fear that even if these software commands produce results that they will be meaningless, given the interleaved nature your data. At least, if you claim that SAS and R differ in reported results, show those results in your question so that others can see for themselves. This is also very close to an off-topic software-specific question. $\endgroup$
    – EdM
    Oct 12 at 12:38
  • $\begingroup$ I do not know what do you really by no information, in summary, I want to convert the SAS file to R, that is it. $\endgroup$
    – Rani
    Oct 12 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.