Suppose I do the following:

    proc phreg data = new; 
         model time*censor(0) = x y;

Also suppose $x$ is a binary variable and $y$ is a continuous variable. How would I plot the survival function for $x = 1$ and $y = 100$ (for example) in SAS?


1 Answer 1


From the help files of phreg (assuming neither X or Y in your example are time varying):

ods graphics on;
    proc phreg data=Myeloma plots(overlay)=survival;
    model Time*VStatus(0)=LogBUN HGB;
    baseline covariates=Inrisks out=Pred1 survival=_all_ / rowid=Id;
    ods graphics off;

The COVARIATES= option in the BASELINE statement specifies the data set that contains the set of covariates of interest. The PLOTS= option in the PROC PHREG statement creates the survivor plot. The OVERLAY suboption overlays the two curves in the same plot. If the OVERLAY suboption is not specified, each curve is displayed in a separate plot. The ROWID= option in the BASELINE statement specifies that the values of the variable Id in the COVARIATES= data set be used to identify the curves in the plot. The SURVIVAL=ALL option in the BASELINE statement requests that the estimated survivor function, standard error, and lower and upper confidence limits for the survivor function be output into the SAS data set specified in the OUT= option. The survival Plot (Output 64.8.1) contains two curves, one for each of row of covariates in the data set Inrisks.

  • $\begingroup$ That is what I did. But it seems that the survival functions stops at 0.9. So it doesn't go all the way down to 0. $\endgroup$
    – markk
    Commented Nov 30, 2011 at 18:43
  • 1
    $\begingroup$ I'm assuming its because your data is censored after 10% of the data experiences the event? $\endgroup$
    – B_Miner
    Commented Nov 30, 2011 at 19:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.