4# keyzhi
Hope I did not misunderstand your problem. I suppose your real data contains much more observations than the example data here, so I do not use the exact logistic model.
I guess you want to work on case1 with control, and case2 with control separately. Since you used group as response variable, I write the codes following this logic.
data keyzhi;
input
group geno$ position sex age;
cards;
1 AG 1 1 56
1 AA 1 1 54
1 AA 1 1 56
1 AG 1 1 77
1 AG 1 1 69
1 AG 1 2 53
1 AG 1 2 54
1 GG 1 1 56
1 AA 2 1 47
1 AA 2 2 70
1 AG 2 1 56
1 AA 2 1 47
1 AA 2 1 76
1 AG 2 1 71
1 AG 2 1 63
1 AG 2 1 62
1 AA 2 1 62
1 GG 2 2 58
1 AG 2 2 65
1 AG 2 1 59
2 AG . 2 50
2 AA . 2 43
2 AA . 2 52
2 GG . 2 43
2 AA . 2 44
2 AG . 2 42
2 AG . 2 47
2 GG . 2 50
2 AG . 2 43
2 GG . 2 43
2 AA . 1 80
2 AA . 2 43
2 AA . 2 48
2 AG . 2 43
2 GG . 2 42
2 AA . 2 44
;
run;
data keyzhi0;
set keyzhi;
if position=1 then case=1;
if position=2 then case=2;
if group=2 then case=0;
run;
data keyzhi1;
set keyzhi0;
if case=2 then delete;
run;
proc genmod data=keyzhi1 descending;
class sex geno;
model case=sex age geno/dist=bin link=logit type3;
run;
data keyzhi2;
set keyzhi0;
if case=1 then delete;
run;
proc genmod data=keyzhi2 descending;
class sex geno;
model case=sex age geno/dist=bin link=logit type3;
run;