Chris,
I had the same problem recently and was able solve my problem courtesy
of this code written by Joseph Coveney. I have tailored the code to my
specific need. It uses Stata's ranksum command to compare the groups
using holm's method. Other methods are available, type help _mtest. As
it stands this code will only work for four groups due to this line in
the code: "forvalues k = `j'/4". Therefore if you have seven groups
your code should read "forvalues k = `j'/7".
Here is the link to the original:
http://www.stata.com/statalist/archive/2003-04/msg00273.html
clear
set more off
infile byte rctime1 byte rctime2 byte rctime3 byte rctime4 using ///
http://www.uni-koeln.de/themen/Statistik/data/winer/win_228.txt
generate person = _n
reshape long rctime, i(person) j(drug)
matrix A = J(1, 3, 0)
local testno = 0
forvalues i = 1/3 {
local j = `i' + 1
forvalues k = `j'/4 {
quietly ranksum rctime if (person==`i'|person==`k'), by(person)
if r(z)>0 matrix B = (`i', `k', 2*(1-norm(r(z))))
else matrix B = (`i', `k', 2*(norm(r(z))))
if `testno' == 0 {
matrix A = B
}
else {
matrix A = A \ B
}
local rownamesA = "`rownamesA'" + "testpair`++testno' "
}
}
matrix rownames A = `rownamesA'
matrix colnames A = onemut othermut unadjustp
_mtest adjust A, mtest(holm) pindex(3) append
matrix list r(result)
exit
Regards,
Raphael
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/