Categorical Data Analysis: Chapter 13
data medical;
input interval treatment $ censor count @@;
datalines;
0 control 1 9 0 control 0 15
1 control 1 7 1 control 0 13
2 control 1 6 2 control 0 7
3 control 1 17
0 active 1 9 0 active 0 12
1 active 1 3 1 active 0 7
2 active 1 4 2 active 0 10
3 active 1 45
;
ods graphics on;
proc lifetest data=medical method=lt plots=(s,ls)
intervals=0 to 3 by 1;
freq count;
strata treatment;
time interval*censor(1);
ods output Lifetest.Stratum1.LifetableEstimates=my
(keep=STRATUM treatment LowerTime UpperTime Survival StdErr);
ods output Lifetest.Stratum2.LifetableEstimates=my2
(keep=STRATUM treatment LowerTime UpperTime Survival StdErr);
run;
ods graphics off;
data all;
set my my2;
run;
proc print data=all noobs;
run;
data clinical;
input time $ treatment $ status $ count @@;
datalines;
0-1 control recur 15 0-1 control not 50
0-1 active recur 12 0-1 active not 69
1-2 control recur 13 1-2 control not 30
1-2 active recur 7 1-2 active not 59
2-3 control recur 7 2-3 control not 17
2-3 active recur 10 2-3 active not 45
;
proc freq order=data;
weight count;
tables time*treatment*status / cmh;
run;
data duodenal;
input center time $ treatment $ status $ count @@;
datalines;
1 0-2 A healed 15 1 0-2 A not 19
1 0-2 P healed 15 1 0-2 P not 24
1 2-4 A healed 17 1 2-4 A not 2
1 2-4 P healed 17 1 2-4 P not 7
2 0-2 A healed 17 2 0-2 A not 27
2 0-2 P healed 12 2 0-2 P not 28
2 2-4 A healed 17 2 2-4 A not 10
2 2-4 P healed 13 2 2-4 P not 15
3 0-2 A healed 7 3 0-2 A not 33
3 0-2 P healed 3 3 0-2 P not 35
3 2-4 A healed 17 3 2-4 A not 16
3 2-4 P healed 17 3 2-4 P not 18
;
proc freq;
weight count;
tables center*time*treatment*status / cmh;
run;
data vda;
input treatment $ time $ failure months;
nmonths=log(months);
datalines;
vda _0-6 23 3894
vda 7-24 32 10872
vda 25-60 45 18720
vh _0-6 9 2016
vh 7-24 5 5724
vh 25-60 10 10440
;
proc genmod data=vda;
class treatment time;
model failure = time treatment
/ dist=poisson link=log offset=nmonths;
run;
data vda;
input treatment time $ failure months;
smonths=100000*months;
datalines;
1 _0-6 23 3894
1 7-24 32 10872
1 25-60 45 18720
0 _0-6 9 2016
0 7-24 5 5724
0 25-60 10 10440
;
proc logistic;
class time/param=ref;
model failure/smonths = time treatment time*treatment /
scale=none include=2 selection=forward;
run;