Add shade to Kaplan Meier plot

March 13, 2019
By

This post was kindly contributed by SAS & Statistics - go there to comment and to read the full post.

data km;
  seed=12345;
  do loc=1 to 2;
    do time=2 to 22 by 1+int(4*ranuni(seed));
      status=int(2*ranuni(seed));
      output;
    end;
  end;
run;

proc lifetest data=km plots=s outsurv=os;
  ods select survivalplot;
  time time*status(1);
  strata loc;
run;

data os;
  retain survhold 1;
  set os;
  if _censor_ = 1 then  SURVIVAL= survhold;
  else survhold= SURVIVAL;
run;

proc sgplot data=os;
  step x=time y=Survival / name=”survival” legendlabel=”Survival” group=stratum;
  band x=time lower=0 upper=survival / modelname=”survival” transparency=.5;
run;

This post was kindly contributed by SAS & Statistics - go there to comment and to read the full post.

Tags: ,

Welcome!

SAS-X.com offers news and tutorials about the various SAS® software packages, contributed by bloggers. You are welcome to subscribe to e-mail updates, or add your SAS-blog to the site.

Sponsors







Dear readers, proc-x is looking for sponsors who would be willing to support the site in exchange for banner ads in the right sidebar of the site. If you are interested, please e-mail me at: tal.galili@gmail.com
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.