# Return to Minitab macro index
# How to save this page as a macro
# CONT.MAC # This macro computes column/row percents for a contingency table, # and does a chi-squared analysis. # # AUTHOR: Darryl K. Nester # Bluffton College # Bluffton, OH 45817 # (419)358 - 3483 # MACRO CONT dat.1-dat.n MCOLUMN dat.1-dat.n pct.1-pct.n temp total MCONSTANT n X Y MTITLE 'Contingency table analysis' #NOTE #NOTE Neither Minitab Inc. nor the author of this MACRO makes any claim #NOTE or offers any warranty whatsoever with regard to the accuracy of #NOTE this MACRO or its suitability for use, and Minitab Inc. and the #NOTE author of this MACRO each disclaims any liability with respect thereto. #NOTE BRIEF 0 let temp = 0 * dat.1 do X=1:N let pct.X = ROUND(dat.X / sum(dat.X) * 1000) / 10 let temp = temp + dat.X enddo let total = ROUND(temp / sum(temp) * 1000) / 10 BRIEF 2 note Column percents: NOTITLE print pct.1-pct.N total BRIEF 0 let Y = N(dat.1) + 2 do X=1:n let pct.X = ROUND(dat.X / temp * 1000) / 10 let pct.X(Y) = ROUND(sum(dat.X) / sum(temp) * 1000) / 10 enddo BRIEF 2 note Row percents: print pct.1-pct.N chisq dat.1-dat.N TITLE ENDMACRO