ods output ParameterEstimates=HR;
Proc PHReg Data=analysis;
Model diag_time*diag(0) = X / risklimits=wald; *risklimits adds CI to ods ds*;
run;
*fill in HR if missing*; *usually if there are interactions*;
Data HR;
Set HR;
if missing(HazardRatio) and not missing(Estimate) then do;
HazardRatio = exp(estimate);
HRLowerCL = exp(estimate - 1.96*stderr);
HRUpperCL = exp(estimate + 1.96*stderr);
end;
run;