/*Voters data for McNemar test */ data matched; input first second count ; datalines; 1 1 794 1 2 150 2 1 86 2 2 570 ; run; /* Normal approximation and exact McNemar test */ proc freq; weight count; tables first*second / agree; exact mcnem; run; /* testing marginal homogeneity via loglinear model and PROC CATMOD */ proc catmod; weight count; response marginals; model first*second = (1 0 , 1 1 ) ; run; /*Cross-sectional design */ data matched; input time $ approval $ count ; datalines; t1 approve 944 t1 disapprove 656 t2 approve 880 t2 disapprove 720 ; proc freq data=matched order=data; weight count; tables time*approval /chisq riskdiff; run;