* Read in the data; PROC IMPORT DATAFILE = 'C:\Documents and Settings\richc\My Documents\CPH931F08\BMTdata.xls' OUT = BMT DBMS = EXCEL REPLACE; SHEET = BMTdata; GETNAMES = YES; RUN; PROC PRINT DATA = BMT; RUN; * Create indicator variables for second and * third disease groups; DATA BMT; SET BMT; Z1 = 0; Z2 = 0; IF DISEASEGROUP = 2 THEN Z1 = 1; IF DISEASEGROUP = 3 THEN Z2 = 1; RUN; * Begin transcript; ODS RTF FILE = 'C:\Documents and Settings\richc\My Documents\CPH931F08\BMTExamples.rtf'; * Perform proportional hazards regression * relating hazard of death or relapse, in * the presence of right censoring, to the * indicator variables for the second and * third disease groups and to a time-dependent * covariate indicating whether platelets * returned to normal levels; PROC PHREG DATA = BMT; MODEL TIMETODEATHORRELAPSE*DEATHORRELAPSE(0) = Z1 Z2 TDPLATEREC / RISKLIMITS; IF (TIMETOPLATEREC < TIMETODEATHORRELAPSE) THEN TDPLATEREC = 1; ELSE TDPLATEREC = 0; RUN; * Perform proportional hazards regression * relating hazard of death or relapse, in * the presence of right censoring, to the * indicator variables for the second and * third disease groups and an indicator * variable for methotrexate use. Include * artificial time-dependent covariates * to assess the proportional hazards * assumption; PROC PHREG DATA = BMT; MODEL TIMETODEATHORRELAPSE*DEATHORRELAPSE(0) = Z1 Z2 MTXUsed NPHZ1 NPHZ2 NPHMTXUsed / RISKLIMITS; NPHZ1 = Z1*log(TIMETODEATHORRELAPSE); NPHZ2 = Z2*log(TIMETODEATHORRELAPSE); NPHMTXUsed = MTXUsed*log(TIMETODEATHORRELAPSE); RUN; * Perform proportional hazards regression * relating hazard of death or relapse, in * the presence of right censoring, to the * indicator variables for the second and * third disease groups, within each stratum * defined by the indicator variable for * methotrexate use, enforcing the same * partial slope coefficient estimates * for each stratum; PROC PHREG DATA = BMT; MODEL TIMETODEATHORRELAPSE*DEATHORRELAPSE(0) = Z1 Z2 / RISKLIMITS; STRATA MTXUsed; RUN; * Perform proportional hazards regression * relating hazard of death or relapse, in * the presence of right censoring, to the * indicator variables for the second and * third disease groups, within each stratum * defined by the indicator variable for * methotrexate use, not enforcing the same * partial slope coefficient estimates * for each stratum; PROC SORT DATA = BMT; BY MTXUsed; RUN; PROC PHREG DATA = BMT; BY MTXUsed; MODEL TIMETODEATHORRELAPSE*DEATHORRELAPSE(0) = Z1 Z2 / RISKLIMITS; RUN; * End transcript; ODS RTF CLOSE; RUN;