@SeaMoon_168 wrote:
Many thanks. Your code worked well with the Myeloma data. However, it did not work using my own data. I attached my data and simply compare base model: DM1 and extended model: DM1 DM2. Could you help me figure it out?
You're welcome. Not sure what exactly "did not work" on your side without seeing your code, log or output. But here is the code that does work with your sample data (which I read into a work dataset SAMPLE from a CSV file created from your Excel file on my private computer, as there is no Excel on my SAS workstation) with the changes highlighted in bold:
/* Create subject ID */
data one;
set sample;
_id_=_n_;
run;
/* Set (arbitrary) reference values for predictor variables */
proc summary data=one;
var DM:;
output out=ref(drop=_:) min=;
run;
/* Create the "dummy observation" as suggested in NRI.sas and set the time point of interest */
data two;
_id_=0;
VStatus=.;
Time=2.5;
set ref;
run;
/* Create input dataset for macro PREDMAC */
data have;
set two one;
run;
/* Call macro PREDMAC with two different Cox models and save the predicted event probabilities */
%PREDMAC(have, _id_, VStatus, Death, Time, DM1, DM1, Base model, probt1)
data mod1;
set preddat;
run;
%PREDMAC(have, _id_, VStatus, Death, Time, DM1 DM2, DM1 DM2, Extended model, probt2)
data mod2;
set preddat;
run;
/* Create input dataset for macro SURV_CONTNRI */
data combo;
merge mod1(keep=_id_ VStatus Time probt1)
mod2(keep=_id_ probt2);
by _id_;
run;
/* Estimate NRI among other statistics */
%SURV_CONTNRI(combo,2,VStatus,Time,2.5,probt1,probt2)
The main result is nri=0.30344... It depends, however, on whether variable DM1 (with values 0, 1, 2, 3) is treated as a CLASS variable by PROC PHREG (as above). If it is treated as a continuous variable, I obtain nri=0.26082... with the PREDMAC macro calls changed to
%PREDMAC(have, _id_, VStatus, Death, Time, , DM1, Base model, probt1)
...
%PREDMAC(have, _id_, VStatus, Death, Time, DM2, DM1 DM2, Extended model, probt2)
As expected, treating DM2 (with values 0, 1) as a continuous variable (i.e., leaving the CLASSVARS parameter of macro PREDMAC blank also in the second call) makes no difference.
... View more