Categorical Data Analysis: Chapter 15
data children;
input id city$ @@;
do i=1 to 4;
input age smoke symptom @@;
output;
end;
datalines;
1 steelcity 8 0 1 9 0 1 10 0 1 11 0 0
2 steelcity 8 2 1 9 2 1 10 2 1 11 1 0
3 steelcity 8 2 1 9 2 0 10 1 0 11 0 0
4 greenhills 8 0 0 9 1 1 10 1 1 11 0 0
5 steelcity 8 0 0 9 1 0 10 1 0 11 1 0
6 greenhills 8 0 1 9 0 0 10 0 0 11 0 1
7 steelcity 8 1 1 9 1 1 10 0 1 11 0 0
8 greenhills 8 1 0 9 1 0 10 1 0 11 2 0
9 greenhills 8 2 1 9 2 0 10 1 1 11 1 0
10 steelcity 8 0 0 9 0 0 10 0 0 11 1 0
11 steelcity 8 1 1 9 0 0 10 0 0 11 0 1
12 greenhills 8 0 0 9 0 0 10 0 0 11 0 0
13 steelcity 8 2 1 9 2 1 10 1 0 11 0 1
14 greenhills 8 0 1 9 0 1 10 0 0 11 0 0
15 steelcity 8 2 0 9 0 0 10 0 0 11 2 1
16 greenhills 8 1 0 9 1 0 10 0 0 11 1 0
17 greenhills 8 0 0 9 0 1 10 0 1 11 1 1
18 steelcity 8 1 1 9 2 1 10 0 0 11 1 0
19 steelcity 8 2 1 9 1 0 10 0 1 11 0 0
20 greenhills 8 0 0 9 0 1 10 0 1 11 0 0
21 steelcity 8 1 0 9 1 0 10 1 0 11 2 1
22 greenhills 8 0 1 9 0 1 10 0 0 11 0 0
23 steelcity 8 1 1 9 1 0 10 0 1 11 0 0
24 greenhills 8 1 0 9 1 1 10 1 1 11 2 1
25 greenhills 8 0 1 9 0 0 10 0 0 11 0 0
;
proc genmod data=children descending;
class id city;
model symptom = city age smoke /
link=logit dist=bin type3;
repeated subject=id / type=exch covb corrw;
run;
proc genmod data=children descending;
class id city;
model symptom = city age smoke /
link=logit dist=bin type3;
repeated subject=id / type=exch covb corrw printmle;
run;
ods select Estimates;
proc genmod data=children descending;
class id city;
model symptom = city age smoke /
link=logit dist=bin type3;
repeated subject=id / type=exch covb corrw;
estimate 'age' age 1 / exp;
run;
proc genmod data=children descending;
class id city;
model symptom = city age smoke /
link=logit dist=bin type3 wald;
repeated subject=id / type=exch covb corrw;
ods output GEEModInfo=clustout Type3=scoreout;
run;
data cross (drop=count);
input age $ sequence $ time1 $ time2 $ count;
do i=1 to count;
output;
end;
datalines;
older AB F F 12
older AB F U 12
older AB U F 6
older AB U U 20
older BP F F 8
older BP F U 5
older BP U F 6
older BP U U 31
older PA F F 5
older PA F U 3
older PA U F 22
older PA U U 20
younger BA F F 19
younger BA F U 3
younger BA U F 25
younger BA U U 3
younger AP F F 25
younger AP F U 6
younger AP U F 6
younger AP U U 13
younger PB F F 13
younger PB F U 5
younger PB U F 21
younger PB U U 11
;
data cross2;
set cross;
subject=_n_;
period=1;
drug = substr(sequence, 1, 1);
carry='N';
response = time1;
output;
period=0;
drug = substr(sequence, 2, 1);
carry = substr(sequence, 1, 1);
if carry='P' then carry='N';
response = time2;
output;
;
proc print data=cross2(obs=15);
run;
proc genmod data=cross2;
class subject age drug carry;
model response = period age drug
period*age carry
drug*age / dist=bin type3;
repeated subject=subject/type=unstr;
run;
ods select Contrasts;
proc genmod data=cross2;
class subject age drug carry;
model response = period age drug
period*age carry
drug*age / dist=bin type3;
repeated subject=subject/type=unstr;
contrast 'carry' carry 1 0 -1,
carry 0 1 -1;
contrast 'inter' age*drug 1 0 -1 -1 0 1 ,
age*drug 0 1 -1 0 -1 1 ;
contrast 'joint' carry 1 0 -1,
carry 0 1 -1,
age*drug 1 0 -1 -1 0 1 ,
age*drug 0 1 -1 0 -1 1 ;
run;
proc genmod data=cross2;
class subject age drug;
model response = period age drug
period*age
/ dist=bin type3;
repeated subject=subject/type=unstr corrw;
run;
ods select Contrasts;
proc genmod data=cross2;
class subject age drug;
model response = period age drug
period*age
/ dist=bin type3;
repeated subject=subject/type=unstr;
contrast 'A versus B' drug 1 -1 0;
run;
data resp;
input center id treatment $ sex $ age baseline
visit1-visit4 @@;
visit=1; outcome=visit1; output;
visit=2; outcome=visit2; output;
visit=3; outcome=visit3; output;
visit=4; outcome=visit4; output;
datalines;
1 53 A F 32 1 2 2 4 2 2 30 A F 37 1 3 4 4 4
1 18 A F 47 2 2 3 4 4 2 52 A F 39 2 3 4 4 4
1 54 A M 11 4 4 4 4 2 2 23 A F 60 4 4 3 3 4
1 12 A M 14 2 3 3 3 2 2 54 A F 63 4 4 4 4 4
1 51 A M 15 0 2 3 3 3 2 12 A M 13 4 4 4 4 4
1 20 A M 20 3 3 2 3 1 2 10 A M 14 1 4 4 4 4
1 16 A M 22 1 2 2 2 3 2 27 A M 19 3 3 2 3 3
1 50 A M 22 2 1 3 4 4 2 16 A M 20 2 4 4 4 3
1 3 A M 23 3 3 4 4 3 2 47 A M 20 2 1 1 0 0
1 32 A M 23 2 3 4 4 4 2 29 A M 21 3 3 4 4 4
1 56 A M 25 2 3 3 2 3 2 20 A M 24 4 4 4 4 4
1 35 A M 26 1 2 2 3 2 2 2 A M 25 3 4 3 3 1
1 26 A M 26 2 2 2 2 2 2 15 A M 25 3 4 4 3 3
1 21 A M 26 2 4 1 4 2 2 25 A M 25 2 2 4 4 4
1 8 A M 28 1 2 2 1 2 2 9 A M 26 2 3 4 4 4
1 30 A M 28 0 0 1 2 1 2 49 A M 28 2 3 2 2 1
1 33 A M 30 3 3 4 4 2 2 55 A M 31 4 4 4 4 4
1 11 A M 30 3 4 4 4 3 2 43 A M 34 2 4 4 2 4
1 42 A M 31 1 2 3 1 1 2 26 A M 35 4 4 4 4 4
1 9 A M 31 3 3 4 4 4 2 14 A M 37 4 3 2 2 4
1 37 A M 31 0 2 3 2 1 2 36 A M 41 3 4 4 3 4
1 23 A M 32 3 4 4 3 3 2 51 A M 43 3 3 4 4 2
1 6 A M 34 1 1 2 1 1 2 37 A M 52 1 2 1 2 2
1 22 A M 46 4 3 4 3 4 2 19 A M 55 4 4 4 4 4
1 24 A M 48 2 3 2 0 2 2 32 A M 55 2 2 3 3 1
1 38 A M 50 2 2 2 2 2 2 3 A M 58 4 4 4 4 4
1 48 A M 57 3 3 4 3 4 2 53 A M 68 2 3 3 3 4
1 5 P F 13 4 4 4 4 4 2 28 P F 31 3 4 4 4 4
1 19 P F 31 2 1 0 2 2 2 5 P F 32 3 2 2 3 4
1 25 P F 35 1 0 0 0 0 2 21 P F 36 3 3 2 1 3
1 28 P F 36 2 3 3 2 2 2 50 P F 38 1 2 0 0 0
1 36 P F 45 2 2 2 2 1 2 1 P F 39 1 2 1 1 2
1 43 P M 13 3 4 4 4 4 2 48 P F 39 3 2 3 0 0
1 41 P M 14 2 2 1 2 3 2 7 P F 44 3 4 4 4 4
1 34 P M 15 2 2 3 3 2 2 38 P F 47 2 3 3 2 3
1 29 P M 19 2 3 3 0 0 2 8 P F 48 2 2 1 0 0
1 15 P M 20 4 4 4 4 4 2 11 P F 48 2 2 2 2 2
1 13 P M 23 3 3 1 1 1 2 4 P F 51 3 4 2 4 4
1 27 P M 23 4 4 2 4 4 2 17 P F 58 1 4 2 2 0
1 55 P M 24 3 4 4 4 3 2 39 P M 11 3 4 4 4 4
1 17 P M 25 1 1 2 2 2 2 40 P M 14 2 1 2 3 2
1 45 P M 26 2 4 2 4 3 2 24 P M 15 3 2 2 3 3
1 40 P M 26 1 2 1 2 2 2 41 P M 15 4 3 3 3 4
1 44 P M 27 1 2 2 1 2 2 33 P M 19 4 2 2 3 3
1 49 P M 27 3 3 4 3 3 2 13 P M 20 1 4 4 4 4
1 39 P M 28 2 1 1 1 1 2 34 P M 20 3 2 4 4 4
1 2 P M 28 2 0 0 0 0 2 45 P M 33 3 3 3 2 3
1 14 P M 30 1 0 0 0 0 2 22 P M 36 2 4 3 3 4
1 10 P M 37 3 2 3 3 2 2 18 P M 38 4 3 0 0 0
1 31 P M 37 1 0 0 0 0 2 35 P M 42 3 2 2 2 2
1 7 P M 43 2 3 2 4 4 2 44 P M 43 2 1 0 0 0
1 52 P M 43 1 1 1 3 2 2 6 P M 45 3 4 2 1 2
1 4 P M 44 3 4 3 4 2 2 46 P M 48 4 4 0 0 0
1 1 P M 46 2 2 2 2 2 2 31 P M 52 2 3 4 3 4
1 46 P M 49 2 2 2 2 2 2 42 P M 66 3 3 3 4 4
1 47 P M 63 2 2 2 2 2
;
data resp2; set resp;
dichot=(outcome=3 or outcome=4);
di_base = (baseline=3 or baseline=4);
run;
proc genmod descending;
class id center sex treatment visit;
model dichot = treatment sex age center di_base
visit visit*treatment treatment*center/
link=logit dist=bin type3;
repeated subject=id*center / type=exch;
run;
proc genmod descending;
class id center sex treatment visit;
model dichot = center sex treatment age di_base
visit / link=logit dist=bin type3;
repeated subject=id*center / type=exch;
run;
proc genmod descending;
class id center sex treatment;
model dichot = center sex treatment age di_base
/ link=logit dist=bin type3;
repeated subject=id*center / type=exch corrw;
run;
proc genmod descending;
class id center sex treatment;
model dichot = center sex treatment age di_base
/ link=logit dist=bin type3;
repeated subject=id*center / type=unstr corrw;
run;
proc genmod descending;
class id center sex treatment;
model dichot = center sex treatment age di_base
/ link=logit dist=bin type3;
repeated subject=id*center / type=ind corrw;
run;
data diagnos;
input std1 $ test1 $ std2 $ test2 $ count;
do i=1 to count;
output;
end;
datalines;
Neg Neg Neg Neg 509
Neg Neg Neg Pos 4
Neg Neg Pos Neg 17
Neg Neg Pos Pos 3
Neg Pos Neg Neg 13
Neg Pos Neg Pos 8
Neg Pos Pos Neg 0
Neg Pos Pos Pos 8
Pos Neg Neg Neg 14
Pos Neg Neg Pos 1
Pos Neg Pos Neg 17
Pos Neg Pos Pos 9
Pos Pos Neg Neg 7
Pos Pos Neg Pos 4
Pos Pos Pos Neg 9
Pos Pos Pos Pos 170
;
data diagnos2;
set diagnos;
drop std1 test1 std2 test2;
subject=_n_;
time=1; procedure='standard';
response=std1; output;
time=1; procedure='test';
response=test1; output;
time=2; procedure='standard';
response=std2; output;
time=2; procedure='test';
response=test2; output;
run;
proc genmod descending;
class subject time procedure;
model response = time procedure time*procedure /
link=logit dist=bin type3;
repeated subject=subject /type=exch;
run;
proc genmod descending;
class subject time procedure;
model response = time procedure /
link=logit dist=bin type3;
repeated subject=subject / type=exch corrw;
run;
proc genmod descending;
class subject time procedure;
model response = time procedure /
link=logit dist=bin type3;
repeated subject=subject /type=unstr corrw;
run;
data fracture;
input ID age center $ treatment $ year1 year2 year3 @@;
total=year1+year2+year3;
lmonths=log(12);
datalines;
1 56 A p 0 0 0 2 71 A p 1 0 0 3 60 A p 0 0 1 4 71 A p 0 1 0
5 78 A p 0 0 0 6 67 A p 0 0 0 7 49 A p 0 0 0
9 75 A p 1 0 0 8 68 A p 0 0 0 11 82 A p 0 0 0
13 56 A p 0 0 0 12 71 A p 0 0 0 15 66 A p 1 0 0
17 78 A p 0 0 0 16 63 A p 0 2 0 19 61 A p 0 0 0
21 75 A p 1 0 0 20 68 A p 0 0 0 23 63 A p 1 1 1
25 54 A p 0 0 0 24 65 A p 0 0 0 27 71 A p 0 0 0
29 56 A p 0 0 0 28 64 A p 0 0 0 31 78 A p 0 0 2
33 76 A p 0 0 0 32 61 A p 0 0 0 35 76 A p 0 0 0
37 74 A p 0 0 0 36 56 A p 0 0 0 39 62 A p 0 0 0
41 56 A p 0 0 0 40 72 A p 0 0 1 43 76 A p 0 0 0
45 75 A p 0 0 0 44 77 A p 2 2 0 47 78 A p 0 0 0
49 71 A p 0 0 0 48 68 A p 0 0 0 51 74 A p 0 0 0
53 69 A p 0 0 0 52 78 A p 1 0 0 55 81 A p 2 0 1
57 68 A p 0 0 0 56 77 A p 0 0 0 59 77 A p 0 0 0
61 75 A p 0 0 0 60 83 A p 0 0 0 63 72 A p 0 0 0 64 88 A p 0 0 0
65 69 A p 0 0 0 66 55 A p 0 0 0 67 76 A p 0 0 0 68 55 A p 0 0 0
69 63 A t 0 0 2 70 52 A t 0 0 0 71 56 A t 0 0 0 72 52 A t 0 0 0
73 74 A t 0 0 0 74 61 A t 0 0 0 75 69 A t 0 0 0 76 61 A t 0 0 0
77 84 A t 0 0 0 78 76 A t 0 1 0 79 59 A t 0 0 1 80 76 A t 0 0 0
81 66 A t 0 0 1 82 78 A t 0 0 1 83 77 A t 0 0 0 84 75 A t 1 0 0
85 75 A t 0 0 0 86 62 A t 0 0 0 87 67 A t 0 0 0 88 62 A t 0 0 0
89 71 A t 0 0 0 90 63 A t 0 0 0 92 68 A t 0 0 0
93 69 A t 0 0 0 94 61 A t 0 0 0 96 61 A t 0 0 0
97 67 A t 0 0 0 98 77 A t 0 0 0 91 70 A t 0 0 1 102 81 A t 0 0 0
95 49 A t 0 0 0 106 55 A t 0 0 0
99 63 A t 2 1 0 100 52 A t 0 0 0 101 48 A t 0 0 0
103 71 A t 0 0 0 104 61 A t 0 0 0 105 74 A t 0 0 0
107 67 A t 0 0 0 108 56 A t 0 0 0 109 54 A t 0 0 0
111 56 A t 0 0 0 112 77 A t 1 0 0 113 65 A t 0 0 0
115 66 A t 0 0 0 116 71 A t 0 0 0 117 71 A t 0 0 0 128 71 A t 0 0 0
119 86 A t 1 0 0 120 81 A t 0 0 0 121 64 A t 0 0 0 132 76 A t 0 0 0
123 71 A t 0 0 0 124 76 A t 0 0 0 125 66 A t 0 0 0 136 76 A t 0 0 0
1 68 B p 0 0 0 2 63 B p 0 0 0 3 66 B p 0 0 0 4 63 B p 0 0 0
5 70 B p 0 1 0 6 62 B p 0 0 0 7 54 B p 1 0 0 8 66 B p 0 0 0
9 71 B p 0 0 0 10 76 B p 0 0 0 11 72 B p 0 0 1 12 65 B p 0 1 0
13 55 B p 0 1 0 14 59 B p 0 0 2 15 61 B p 1 0 0 16 56 B p 0 1 0
17 54 B p 0 0 0 18 68 B p 0 0 0 19 68 B p 0 0 0 20 81 B p 0 0 0
21 81 B p 1 0 0 22 61 B p 2 0 1 23 72 B p 1 0 0 24 67 B p 0 0 0
25 56 B p 0 0 0 26 66 B p 0 0 0 27 71 B p 0 1 0 28 75 B p 0 1 0
29 76 B p 0 0 0 30 73 B p 2 0 0 31 56 B p 0 0 0 32 89 B p 0 0 0
33 56 B p 0 0 0 34 78 B p 0 0 0 35 55 B p 0 0 0 36 73 B p 0 0 1
37 71 B p 0 0 0 38 56 B p 0 0 0 39 69 B p 0 0 0 40 77 B p 0 0 0
41 89 B p 0 0 0 42 63 B p 0 0 0 43 67 B p 0 0 0 44 73 B p 0 0 0
45 60 B p 0 0 0 46 67 B p 0 0 0 47 56 B p 0 0 0 48 78 B p 0 0 0
49 73 B t 1 0 0 50 76 B t 0 0 0 51 61 B t 0 0 0 52 81 B t 0 0 0
53 55 B t 0 0 0 54 82 B t 0 0 0 55 78 B t 0 0 0 56 60 B t 0 0 0
57 56 B t 0 0 0 58 83 B t 0 0 0 59 55 B t 0 0 0 60 60 B t 0 0 0
61 80 B t 0 0 0 62 78 B t 0 0 0 63 67 B t 0 0 0 64 67 B t 0 0 0
65 56 B t 0 0 0 66 72 B t 0 0 0 67 71 B t 0 0 0 68 83 B t 0 0 0
69 66 B t 0 0 0 70 71 B t 0 0 1 71 78 B t 1 0 2 72 61 B t 0 0 0
73 56 B t 0 0 0 74 61 B t 0 0 0 75 55 B t 0 0 0 76 69 B t 1 1 0
77 71 B t 0 0 0 78 76 B t 0 0 0 79 56 B t 0 0 0 80 75 B t 0 0 0
81 89 B t 0 0 0 82 77 B t 0 0 0 83 77 B t 1 0 0 84 73 B t 0 0 0
85 60 B t 0 0 0 86 61 B t 0 0 0 87 79 B t 0 0 0 88 71 B t 0 0 0
89 61 B t 0 0 0 90 79 B t 0 0 0 91 87 B t 1 0 0 92 55 B t 0 0 0
93 55 B t 0 0 0 94 79 B t 0 0 0 95 66 B t 0 0 0 96 49 B t 0 0 0
97 56 B t 0 0 0 98 64 B t 0 0 0 99 88 B t 0 0 0 100 62 B t 1 0 0
101 80 B t 0 0 1 102 65 B t 0 0 0 103 57 B t 0 0 1 104 85 B t 0 0 0
;
data fracture2;
set fracture;
drop year1-year3;
year=1; fractures=year1; output;
year=2; fractures=year2; output;
do; if center = A then do;
if (ID=85 or ID=66 or ID=124 or ID=51) then lmonths=log(6); end;
if center = B then do;
if (ID=29 or ID=45 or ID=55) then lmonths=log(6); end;
end;
year=3; fractures=year3; output;
run;
proc genmod;
class id treatment center year;
model fractures = center treatment age year treatment*center
treatment*year/
dist=poisson type3 offset=lmonths;
repeated subject=id*center / type=exch corrw;
run;
proc genmod;
class id treatment center year;
model fractures = center treatment age year /
dist=poisson type3 offset=lmonths;
repeated subject=id(center) / type=exch corrw;
run;
proc genmod data=resp descending;
class id center sex treatment visit;
model outcome = treatment sex center age baseline
visit visit*treatment /
link=clogit dist=mult type3;
repeated subject=id*center / type=ind;
run;
proc genmod data=resp descending;
class id center sex treatment visit;
model outcome = treatment center baseline
visit visit*treatment /
link=clogit dist=mult type3;
repeated subject=id*center / type=ind;
run;
data skincross;
input subject gender $ sequence $ Time1 $ Time2 $ @@;
datalines;
1 m AB Y Y 101 m PA Y Y 201 f AP Y Y
2 m AB Y . 102 m PA Y Y 202 f AP Y Y
3 m AB Y Y 103 m PA Y Y 203 f AP Y Y
4 m AB Y . 104 m PA Y Y 204 f AP Y Y
5 m AB Y Y 105 m PA Y Y 205 f AP Y Y
6 m AB Y . 106 m PA Y N 206 f AP Y Y
7 m AB Y . 107 m PA Y . 207 f AP Y Y
8 m AB Y Y 108 m PA Y N 208 f AP Y Y
9 m AB Y Y 109 m PA N . 209 f AP Y Y
10 m AB Y Y 110 m PA N Y 210 f AP Y Y
11 m AB Y . 111 m PA N Y 211 f AP Y Y
12 m AB Y Y 112 m PA N Y 212 f AP Y Y
13 m AB Y N 113 m PA N . 213 f AP Y Y
14 m AB Y N 114 m PA N . 214 f AP Y .
15 m AB Y N 115 m PA N Y 215 f AP Y .
16 m AB Y N 116 m PA N Y 216 f AP Y .
17 m AB Y N 117 m PA N Y 217 f AP Y Y
18 m AB Y N 118 m PA N Y 218 f AP Y Y
19 m AB Y . 119 m PA N Y 219 f AP Y Y
20 m AB Y N 120 m PA N Y 220 f AP Y Y
21 m AB Y N 121 m PA N Y 221 f AP Y .
22 m AB Y N 122 m PA N Y 222 f AP Y Y
23 m AB Y . 123 m PA N Y 223 f AP Y Y
24 m AB Y N 124 m PA N Y 224 f AP Y Y
25 m AB N Y 125 m PA N Y 225 f AP Y Y
26 m AB N . 126 m PA N Y 226 f AP Y N
27 m AB N . 127 m PA N Y 227 f AP Y N
28 m AB N . 128 m PA N Y 228 f AP Y N
29 m AB N Y 129 m PA N Y 229 f AP Y .
30 m AB N Y 130 m PA N Y 230 f AP Y N
31 m AB N . 131 m PA N . 231 f AP Y N
32 m AB N N 132 m PA N N 232 f AP N Y
33 m AB N N 133 m PA N N 233 f AP N Y
34 m AB N N 134 m PA N N 234 f AP N Y
35 m AB N N 135 m PA N N 235 f AP N Y
36 m AB N N 136 m PA N . 236 f AP N Y
37 m AB N N 137 m PA N N 237 f AP N Y
38 m AB N N 138 m PA N N 238 f AP N N
39 m AB N N 139 m PA N . 239 f AP N N
40 m AB N N 140 m PA N N 240 f AP N N
41 m AB N . 141 m PA N N 241 f AP N N
42 m AB N N 142 m PA N N 242 f AP N N
43 m AB N N 143 m PA N N 243 f AP N N
44 m AB N N 144 m PA N N 244 f AP N N
45 m AB N . 145 m PA N N 245 f AP N N
46 m AB N N 146 m PA N N 246 f AP N N
47 m AB N N 147 m PA N N 247 f AP N N
48 m AB N N 148 m PA N N 248 f AP N N
49 m AB N N 149 m PA N N 249 f AP N N
50 m AB N N 150 m PA N . 250 f AP N N
51 m BP Y Y 151 f BA Y Y 251 f PB Y .
52 m BP Y Y 152 f BA Y Y 252 f PB Y Y
53 m BP Y Y 153 f BA Y Y 253 f PB Y Y
54 m BP Y Y 154 f BA Y . 254 f PB Y Y
55 m BP Y Y 155 f BA Y Y 255 f PB Y Y
56 m BP Y Y 156 f BA Y Y 256 f PB Y .
57 m BP Y Y 157 f BA Y Y 257 f PB Y Y
58 m BP Y Y 158 f BA Y Y 258 f PB Y .
59 m BP Y N 159 f BA Y Y 259 f PB Y Y
60 m BP Y . 160 f BA Y Y 260 f PB Y Y
61 m BP Y N 161 f BA Y . 261 f PB Y Y
62 m BP Y . 162 f BA Y . 262 f PB Y .
63 m BP Y N 163 f BA Y Y 263 f PB Y .
64 m BP N Y 164 f BA Y Y 264 f PB Y N
65 m BP N Y 165 f BA Y Y 265 f PB Y N
66 m BP N Y 166 f BA Y Y 266 f PB Y N
67 m BP N Y 167 f BA Y Y 267 f PB Y N
68 m BP N Y 168 f BA Y Y 268 f PB Y N
69 m BP N Y 169 f BA Y Y 269 f PB N Y
70 m BP N . 170 f BA Y . 270 f PB N Y
71 m BP N N 171 f BA Y N 271 f PB N Y
72 m BP N N 172 f BA Y N 272 f PB N .
73 m BP N N 173 f BA N Y 273 f PB N .
74 m BP N N 174 f BA N Y 274 f PB N Y
75 m BP N N 175 f BA N . 275 f PB N Y
76 m BP N N 176 f BA N Y 276 f PB N Y
77 m BP N N 177 f BA N Y 277 f PB N .
78 m BP N N 178 f BA N Y 278 f PB N Y
79 m BP N N 179 f BA N . 279 f PB N Y
80 m BP N N 180 f BA N . 280 f PB N Y
81 m BP N . 181 f BA N Y 281 f PB N Y
82 m BP N N 182 f BA N Y 282 f PB N Y
83 m BP N . 183 f BA N Y 283 f PB N Y
84 m BP N N 184 f BA N Y 284 f PB N Y
85 m BP N . 185 f BA N Y 285 f PB N Y
86 m BP N N 186 f BA N Y 286 f PB N Y
87 m BP N N 187 f BA N Y 287 f PB N Y
88 m BP N N 188 f BA N Y 288 f PB N Y
89 m BP N N 189 f BA N Y 289 f PB N Y
90 m BP N N 190 f BA N Y 290 f PB N N
91 m BP N N 191 f BA N Y 291 f PB N N
92 m BP N . 192 f BA N Y 292 f PB N .
93 m BP N N 193 f BA N Y 293 f PB N N
94 m BP N N 194 f BA N Y 294 f PB N N
95 m BP N N 195 f BA N Y 295 f PB N N
96 m BP N N 196 f BA N Y 296 f PB N N
97 m BP N N 197 f BA N Y 297 f PB N N
98 m BP N N 198 f BA N N 298 f PB N N
99 m BP N N 199 f BA N N 299 f PB N N
100 m BP N . 200 f BA N N 300 f PB N N
;
data skincross2;
set skincross;
period=1;
treatment=substr(sequence, 1, 1);
carry='N';
response=Time1;
output;
period=2;
Treatment=substr(sequence, 2, 1);
carry = substr(sequence, 1, 1);
if carry='P' then carry='N';
response=Time2;
output;
run;
proc genmod data=skincross2 descending;
class subject treatment period gender carry;
model response = treatment period gender carry
gender*period /type3
dist=bin link=logit;
repeated subject=subject / type=exch;
run;
proc genmod data=skincross2 descending;
class subject treatment period gender;
model response = treatment period gender gender*period
/type3
dist=bin link=logit;
repeated subject=subject / type=exch;
estimate 'OR:A-B' treatment 1 -1 0 /exp;
estimate 'OR:A-P' treatment 1 0 -1 / exp;
estimate 'OR:B-P' treatment 0 1 -1 / exp;
run;
proc genmod data=resp2 descending;
class id treatment sex center visit;
model dichot = center sex treatment age di_base visit
/ dist=bin type3 link=logit;
repeated subject=id*center / logor=exch;
run;
proc genmod data=resp2 descending;
class id treatment sex center visit;
model dichot = center sex treatment age di_base visit
/ dist=bin type3 link=logit;
repeated subject=id*center / logor=logorvar(center) corrw;
run;
proc genmod data=resp2 descending;
class id treatment sex center visit;
model dichot = center sex treatment age di_base visit
/ dist=bin type3 link=logit;
repeated subject=id*center / logor=fullclust;
run;
data lri;
input id count risk passive crowding ses agegroup race @@;
logrisk =log(risk/52);
datalines;
1 0 42 1 0 2 2 0 96 1 41 1 0 1 2 0 191 0 44 1 0 0 2 0
2 0 43 1 0 0 2 0 97 1 26 1 1 2 2 0 192 0 45 0 0 0 2 1
3 0 41 1 0 1 2 0 98 0 36 0 0 0 2 0 193 0 42 0 0 0 2 0
4 1 36 0 1 0 2 0 99 0 34 0 0 0 2 0 194 1 31 0 0 0 2 1
5 1 31 0 0 0 2 0 100 1 3 1 1 2 3 1 195 0 35 0 0 0 2 0
6 0 43 1 0 0 2 0 101 0 45 1 0 0 2 0 196 1 35 1 0 0 2 0
7 0 45 0 0 0 2 0 102 0 38 0 0 1 2 0 197 1 27 1 0 1 2 0
8 0 42 0 0 0 2 1 103 0 41 1 1 1 2 1 198 1 33 0 0 0 2 0
9 0 45 0 0 0 2 1 104 1 37 0 1 0 2 0 199 0 39 1 0 1 2 0
10 0 35 1 1 0 2 0 105 0 40 0 0 0 2 0 200 3 40 0 1 2 2 0
11 0 43 0 0 0 2 0 106 1 35 1 0 0 2 0 201 4 26 1 0 1 2 0
12 2 38 0 0 0 2 0 107 0 28 0 1 2 2 0 202 0 14 1 1 1 1 1
13 0 41 0 0 0 2 0 108 3 33 0 1 2 2 0 203 0 39 0 1 1 2 0
14 0 12 1 1 0 1 0 109 0 38 0 0 0 2 0 204 0 4 1 1 1 3 0
15 0 6 0 0 0 3 0 110 0 42 1 1 2 2 1 205 1 27 1 1 1 2 1
16 0 43 0 0 0 2 0 111 0 40 1 1 2 2 0 206 0 36 1 0 0 2 1
17 2 39 1 0 1 2 0 112 0 38 0 0 0 2 0 207 0 30 1 0 2 2 1
18 0 43 0 1 0 2 0 113 2 37 0 1 1 2 0 208 0 34 0 1 0 2 0
19 2 37 0 0 0 2 1 114 1 42 0 1 0 2 0 209 1 40 1 1 1 2 0
20 0 31 1 1 1 2 0 115 5 37 1 1 1 2 1 210 0 6 1 0 1 1 1
21 0 45 0 1 0 2 0 116 0 38 0 0 0 2 0 211 1 40 1 1 1 2 0
22 1 29 1 1 1 2 1 117 0 4 0 0 0 3 0 212 2 43 0 1 0 2 0
23 1 35 1 1 1 2 0 118 2 37 1 1 1 2 0 213 0 36 1 1 1 2 0
24 3 20 1 1 2 2 0 119 0 39 1 0 1 2 0 214 0 35 1 1 1 2 1
25 1 23 1 1 1 2 0 120 0 42 1 1 0 2 0 215 1 35 1 1 2 2 0
26 1 37 1 0 0 2 0 121 0 40 1 0 0 2 0 216 0 43 1 0 1 2 0
27 0 49 0 0 0 2 0 122 0 36 1 0 0 2 0 217 0 33 1 1 2 2 0
28 0 35 0 0 0 2 0 123 1 42 0 1 1 2 0 218 0 36 0 1 1 2 1
29 3 44 1 1 1 2 0 124 1 39 0 0 0 2 0 219 1 41 0 0 0 2 0
30 0 37 1 0 0 2 0 125 2 29 0 0 0 2 0 220 0 41 1 1 0 2 1
31 2 39 0 1 1 2 0 126 3 37 1 1 2 2 1 221 1 42 0 0 0 2 1
32 0 41 0 0 0 2 0 127 0 40 1 0 0 2 0 222 0 33 0 1 2 2 1
33 1 46 1 1 2 2 0 128 0 40 0 0 0 2 0 223 0 40 1 1 2 2 0
34 0 5 1 1 2 3 1 129 0 39 0 0 0 2 0 224 0 40 1 1 1 2 1
35 1 29 0 0 0 2 0 130 0 40 1 0 1 2 0 225 0 40 0 0 2 2 0
36 0 31 0 1 0 2 0 131 1 32 0 0 0 2 0 226 0 28 1 0 1 2 0
37 0 22 1 1 2 2 0 132 0 46 1 0 1 2 0 227 0 47 0 0 0 2 1
38 1 22 1 1 2 2 1 133 4 39 1 1 0 2 0 228 0 18 1 1 2 2 1
39 0 47 0 0 0 2 0 134 0 37 0 0 0 2 0 229 0 45 1 0 0 2 0
40 1 46 1 1 1 2 1 135 0 51 0 0 1 2 0 230 0 35 0 0 0 2 0
41 0 37 0 0 0 2 0 136 1 39 1 1 0 2 0 231 1 17 1 0 1 1 1
42 1 39 0 0 0 2 0 137 1 34 1 1 0 2 0 232 0 40 0 0 0 2 0
43 0 33 0 1 1 2 1 138 1 14 0 1 0 1 0 233 0 29 1 1 2 2 0
44 0 34 1 0 1 2 0 139 2 15 1 0 0 2 0 234 1 35 1 1 1 2 0
45 3 32 1 1 1 2 0 140 1 34 1 1 0 2 1 235 0 40 0 0 2 2 0
46 3 22 0 0 0 2 0 141 0 43 0 1 0 2 0 236 1 22 1 1 1 2 0
47 1 6 1 0 2 3 0 142 1 33 0 0 0 2 0 237 0 42 0 0 0 2 0
48 0 38 0 0 0 2 0 143 3 34 1 0 0 2 1 238 0 34 1 1 1 2 1
49 1 43 0 1 0 2 0 144 0 48 0 0 0 2 0 239 6 38 1 0 1 2 0
50 2 36 0 1 0 2 0 145 4 26 1 1 0 2 0 240 0 25 0 0 1 2 1
51 0 43 0 0 0 2 0 146 0 30 0 1 2 2 1 241 0 39 0 1 0 2 0
52 0 24 1 0 0 2 0 147 0 41 1 1 1 2 0 242 1 35 0 1 2 2 1
53 0 25 1 0 1 2 1 148 0 34 0 1 1 2 0 243 1 36 1 1 1 2 1
54 0 41 0 0 0 2 0 149 0 43 0 1 0 2 0 244 0 23 1 0 0 2 0
55 0 43 0 0 0 2 0 150 1 31 1 0 1 2 0 245 4 30 1 1 1 2 0
56 2 31 0 1 1 2 0 151 0 26 1 0 1 2 0 246 1 41 1 1 1 2 1
57 3 28 1 1 1 2 0 152 0 37 0 0 0 2 0 247 0 37 0 1 1 2 0
58 1 22 0 0 1 2 1 153 0 44 0 0 0 2 0 248 0 46 1 1 0 2 0
59 1 11 1 1 1 1 0 154 0 40 1 0 0 2 0 249 0 45 1 1 0 2 1
60 3 41 0 1 1 2 0 155 0 8 1 1 1 3 1 250 1 38 1 1 1 2 0
61 0 31 0 0 1 2 0 156 0 40 1 1 1 2 1 251 0 10 1 1 1 1 0
62 0 11 0 0 1 1 1 157 1 45 0 0 0 2 0 252 0 30 1 1 2 2 0
63 0 44 0 1 0 2 0 158 0 4 0 0 2 3 0 253 0 32 0 1 2 2 0
64 0 9 1 0 0 3 1 159 1 36 0 1 0 2 0 254 0 46 1 0 0 2 0
65 0 36 1 1 1 2 0 160 3 37 1 1 1 2 0 255 5 35 1 1 2 2 1
66 0 29 1 0 0 2 0 161 0 15 1 0 0 1 0 256 0 44 0 0 0 2 0
67 0 27 0 1 0 2 1 162 1 27 1 0 1 2 1 257 0 41 0 1 1 2 0
68 0 36 0 1 0 2 0 163 2 31 0 1 0 2 0 258 2 36 1 0 1 2 0
69 1 33 1 0 0 2 0 164 0 42 0 0 0 2 0 259 0 34 1 1 1 2 1
70 2 13 1 1 2 1 1 165 0 42 1 0 0 2 0 260 1 30 0 1 0 2 1
71 0 38 0 0 0 2 0 166 1 38 0 0 0 2 0 261 1 27 1 0 0 2 0
72 0 41 0 0 0 2 1 167 0 44 1 0 0 2 0 262 0 48 1 0 0 2 0
73 0 41 1 0 2 2 0 168 0 45 0 0 0 2 0 263 1 6 0 1 2 3 1
74 0 35 0 0 1 2 0 169 0 34 0 1 0 2 0 264 0 38 1 1 0 2 1
75 0 45 0 0 0 2 0 170 2 41 0 0 0 2 0 265 0 29 1 1 1 2 1
76 4 38 1 0 2 2 1 171 2 30 1 1 1 2 0 266 1 43 0 1 2 2 1
77 1 42 1 0 0 2 1 172 0 44 0 0 0 2 0 267 0 43 0 1 0 2 0
78 1 42 1 1 2 2 1 173 0 40 1 0 0 2 0 268 0 37 1 0 2 2 0
79 6 36 1 1 0 2 0 174 2 31 0 0 0 2 0 269 1 23 1 1 0 2 1
80 2 23 1 1 1 2 1 175 0 41 1 0 0 2 0 270 0 44 0 0 1 2 0
81 1 32 0 0 1 2 0 176 0 41 0 0 0 2 0 271 0 5 0 1 1 3 1
82 0 41 0 1 0 2 0 177 0 39 1 0 0 2 0 272 0 25 1 0 2 2 0
83 0 50 0 0 0 2 0 178 0 40 1 0 0 2 0 273 0 25 1 0 1 2 0
84 0 42 1 1 1 2 1 179 2 35 1 0 2 2 0 274 1 28 1 1 1 2 1
85 1 30 0 0 0 2 0 180 1 43 1 0 0 2 0 275 0 7 0 1 0 3 1
86 2 47 0 1 0 2 0 181 2 39 0 0 0 2 0 276 0 32 0 0 0 2 0
87 1 35 1 1 2 2 0 182 0 35 1 1 0 2 0 277 0 41 0 0 0 2 0
88 1 38 1 0 1 2 1 183 0 37 0 0 0 2 0 278 1 33 1 1 2 2 1
89 1 38 1 1 1 2 1 184 3 37 0 0 0 2 0 279 2 36 1 1 2 2 0
90 1 38 1 1 1 2 1 185 0 43 0 0 0 2 0 280 0 31 0 0 0 2 0
91 0 32 1 1 1 2 0 186 0 42 0 0 0 2 0 281 0 18 0 0 0 2 0
92 1 3 1 0 1 3 1 187 0 42 0 0 0 2 0 282 1 32 1 0 2 2 0
93 0 26 1 0 0 2 1 188 0 38 0 0 0 2 0 283 0 22 1 1 2 2 1
94 0 35 1 0 0 2 0 189 0 36 1 0 0 2 0 284 0 35 0 0 0 2 1
95 3 37 1 0 0 2 0 190 0 39 0 1 0 2 0
;
proc genmod data=lri;
class ses id race agegroup;
model count = passive crowding ses race agegroup/
dist=poisson link=log offset=logrisk type3;
run;
proc genmod data=lri;
class id ses race agegroup;
model count = passive crowding ses race agegroup /
dist=poisson link=log offset=logrisk type3;
repeated subject=id / type=ind;
run;
%macro geef;
data temp1;
set clustout;
drop Label1 cvalue1;
if Label1='Number of Clusters';
run;
data temp2;
set scoreout;
drop ProbChiSq;
run;
data temp3;
merge temp1 temp2;
run;
data temp4; set temp3;
retain nclusters; drop nvalue1;
if _n_=1 then nclusters=nvalue1;
run;
data temp5;
set temp4;
drop ChiSq nclusters d;
d=nclusters-1;
NewF= ((d-df+1)*ChiSq)/(d*df);
ProbF=1-cdf('F', NewF,df,d-df+1);
run;
/* Set the ODS path to include your store first (this
sets the search path order so that ODS looks in your
store first, followed by the default store */
ods path sasuser.templat (update)
sashelp.tmplmst (read);
/* Print the path to the log to make sure you will get
what you expect */
*ods path show;
/* Define your table, and store it */
proc template;
define table GEEType3F;
parent=Stat.Genmod.Type3GEESc;
header "#F-Statistics for Type 3 GEE Analysis##";
column Source DF i NewF ProbF;
define NewF;
parent = Common.ANOVA.FValue;
end;
end;
run;
title1;
data _null_;
set temp5;
file print ods=(template='GEEType3F');
put _ods_;
run;
;
%mend geef;