Search code examples
sassurvival-analysis

Obtain the smoothed hazard estimates


How can I obtain a data set or table with the smoothed hazard estimates and the 95% confidence intervals with time which are displayed when I run for example

ods graphics on;
proc lifetest data=melanoma34 plots=(h(cl));
  time weeks*censor(1);
run;

EDIT This is what I run

data melanoma34;
  infile '/folders/myfolders/amsus/data/melanoma34.dat';
  input weeks status$;
  if status='alive' then censor=1;
     else censor=0;
run;

Proc lifetest data=Melanoma34 outsurv=hazards;
  time weeks*censor(1);
ods output hazardplot=smoothedhazard;
run;

and the hazards outsurv does not contain the smoothed hazard estimates

enter image description here. The data can be found here under /amsus/data/


Solution

  • The outsurv data set contains the hazard function estimates and the confidence interval.

    Proc lifetest data=Melanoma outsurv=hazards;
    

    EDIT: The above generates an estimate for the hazard function, not the smoothed estimate and only works for method=LT.

    To obtain the smooth estimate, using method=KM (default), then use the following line:

    ods output hazardplot=smoothedhazard;
    

    Final code:

    data melanoma34;
      infile '/folders/myfolders/amsus/data/melanoma34.dat';
      input weeks status$;
      if status='alive' then censor=1;
         else censor=0;
    run;
    
    Proc lifetest data=Melanoma34 plots=h(cl));
      time weeks*censor(1);
    ods output hazardplot=smoothedhazard;
    run;