data new; input Sex Poor Single Any Count; datalines; 1 1 1 1 342 1 1 1 0 26 1 1 0 1 11 1 1 0 0 32 1 0 1 1 6 1 0 1 0 21 1 0 0 1 19 1 0 0 0 356 2 1 1 1 440 2 1 1 0 25 2 1 0 1 14 2 1 0 0 47 2 0 1 1 14 2 0 1 0 18 2 0 0 1 22 2 0 0 0 457 ; run; data new; set new; sex = sex-1; case = _n_; q1=1; q2=0; resp = poor; output; q1=0; q2=1; resp = single; output; q1=0; q2=0; resp = any; output; drop poor single any; run; proc nlmixed qpoints = 50; parms alpha=0 beta1=.8 beta2=.3 gamma=0 sigma=8.6; eta = alpha + beta1*q1 + beta2*q2 + gamma*sex + u; p = exp(eta)/(1 + exp(eta)); model resp ~ binary(p); random u ~ normal(0,sigma*sigma) subject = case; replicate count; estimate 'odds: poor vs. any ' exp(beta1); estimate 'odds: single vs. any ' exp(beta2); estimate 'odds: single vs. poor' exp(beta2-beta1); estimate 'odds: female vs. male' exp(gamma); run; *Marginal model using GEE; data new; input sex poor single any count @@; datalines; 1 1 1 1 342 1 1 1 0 26 1 1 0 1 11 1 1 0 0 32 1 0 1 1 6 1 0 1 0 21 1 0 0 1 19 1 0 0 0 356 2 1 1 1 440 2 1 1 0 25 2 1 0 1 14 2 1 0 0 47 2 0 1 1 14 2 0 1 0 18 2 0 0 1 22 2 0 0 0 457 ; run; data new; set new; case=0; seq=_n_; * nesting case within sequence type (Y1,y2,y3); do i=1 to count; case=case+1; q1=1; q2=0; resp = poor; output; q1=0; q2=1; resp = single; output; q1=0; q2=0; resp = any; output; end; drop poor single any i count; run; proc genmod; class case sex seq; model resp=q1 q2 sex / dist=bin link=logit; repeated subject=case(seq) / type=exch; estimate "odds poor vs. single" q1 1 q2 -1 / exp; run;