/* SAS code for Kaplan-Meier estimation of surviror functions to times from the VA lung cancer trial of 137 male patients with inoperable lung cancer. This code is posted as vakm.sas */ /* Variables Treatment: 1=standard, 2=test (chemotherapy) Celltype: 1=squamous, 2=smallcell, 3=adeno, 4=large Survival in days Status: 1=dead, 0=censored Karnofsky score Months from Diagnosis Age in years Prior therapy: 0=no, 10=yes */ data va; infile 'c:\stat565\va.dat'; input rx cellt time status karno months age prior_rx; prior_rx = prior_rx/10; if (cellt=1) then celltype= 'squamous'; if (cellt=2) then celltype= 'smallcell'; if (cellt=3) then celltype= 'adeno'; if (cellt=4) then celltype= 'large'; proc lifetest method=KM plots=(s) graphics outs=su data=va; time time*status(0); strata rx; symbol1 v=none color=black line=1; symbol2 v=none color=black line=2; run; proc print data=su; run; /* Delete censored cases */ data su2; set su; if _CENSOR_=0; run; goptions rotate=landscape; axis1 label=(f=swiss h=1.2 a=90 r=0 "Survial Probability") order = 0 to 1 by 0.1 length= 4.3in w=3 value=(f=swiss h=1.0); axis2 label=(f=swiss h=1.2 "Time(days)") order = 0 to 1000 by 100 value=(f=swiss h=1.0) w=3 length = 6. in; proc gplot data=su2; by rx; plot (SURVIVAL SDF_LCL SDF_UCL)*time/ overlay vaxis=axis1 haxis=axis2;; symbol1 v=none interpol=join color=black line=1 w=4; symbol2 v=none interpol=join color=black line=3 w=4; symbol3 v=none interpol=join color=black line=3 w=4; title ls=0.4 H=2.0 F=swiss "Estimated Survivor Function"; run;