MACRO Fisher nreps n1 n2 x obsdiff Mconstant nreps n1 n2 x x1 x2 n nx I obsdiff Pvalue Count Mcolumn sample trmt1 diffprop phat1 phat2 Let n = n1 + n2 Let nx = n - x Set sample x(1) nx(0) End Let Count = 0 Do I = 1:nreps Sample n1 sample trmt1 Let x1 = sum(trmt1) Let x2 = x - x1 Let diffprop(I) = x1/n1 - x2/n2 If abs(diffprop(I)) GE obsdiff Let Count = Count +1 EndIf EndDo Let Pvalue = Count/nreps Print Pvalue Stem-and-Leaf diffprop. Histogram diffprop; Percent; CutPoint -1:1/.1; Bar; Type 1; Color 3; Title "Resampling Distribution"; Title "Difference in 2 proportions"; Minimum 1 -1; Maximum 1 1; ScFrame; ScAnnotation; Axis 1; Label "Difference in Proportions"; Axis 2; Tick 1; NMajor 5; NMinor 4; Tick 2; NMajor 6; NMinor 4. ENDMACRO