********************************************; * Comparison of three treatments (AA, BB, CC) for leukemia * Remission times given in days * * The test below (in `proc lifetest') does generalized logrank * (Cox-Mantel) and Wilcoxon (Gehan-Wilcoxon) tests for three * treatment groups (a=1,2,3 for sample names AA, BB, CC). * The tests are for * H_0: The S_a(t) is equal across all strata (a=1,2,3) * against the alternative * H_1: One or more S_a(t) are shifted (longer- or shorter-lived) * in comparison with the others. * * Thus, the tests are comparable to a one-way ANOVA or * Kruskal-Wallis test for censored data. * * In the data step, to make the data easier to read, censored * observations are entered as NEGATIVE VALUES and then converted * to positive values in the data step. This saves the trouble of * entering a censoring state variable explicitly and trying to * remember whether `state=1' means observed death or censored. * * The command `input zz$ @@' reads all data as text. The final * `@@' tells SAS to read multiple records per line. * (Otherwise, in this case, only the first word per line * would be read.) * * If zz is AA or BB or CC, then the sample name is remembered * and the next word is read. The `retain' statement is required for * SAS to remember a value from one record to the next. * * If zz is a number, the command `zval=input(zz,12.0)' converts the * text string to a number. * The true time is days=abs(zval) (absolute value). * The survival time status=(zval<0)=1 if zval<0 (for CENSORED) * and status=(zval<0)=0 if zval>0 (OBSERVED DEATH). * Finally, the record is written. The use of `output' guarantees * that records are written only if they have valid information. * * Data from Table 5.11, p130, in the textbook, * Elisa Lee and John Wang, * ``Statistical methods for survival data analysis'', 3rd edn ********************************************; title 'COMPARISON of three treatments - YOURNAME'; options ls=75 ps=60 pageno=1 nocenter; data ltmulti; retain group; input zz$ @@; if zz='AA' or zz='BB' or zz='CC' then group=zz; else do; zval=input(zz,12.0); days=abs(zval); status=(zval<0); output; end; drop zz; datalines; AA 4 5 9 10 12 13 10 23 28 28 28 29 31 32 37 41 41 57 62 74 100 139 -20 -258 -269 BB 8 10 10 12 14 20 48 70 75 99 103 162 169 195 230 -161 -199 -217 -245 CC 8 10 11 23 25 25 28 28 31 31 40 48 89 124 143 -12 -159 -190 -196 -197 -205 -219 ; proc print; title2 'The data as SAS sees it'; run; ********************************************; * See the comments in `ltangina.sas' for the meaning and * interpretation of the `plots' and `notable' commands. ********************************************; proc lifetest plots=(s,ls) notable lineprinter; title2 'Graphs and tests using Proc Lifetest'; strata group; time days*status(1); run;