Dear Statalists!
I am using permute in Stata 13.0 and Stata issues the error message "__000005 not found" which I can't interpret. I've searched the error, but only found some unrelated posts.
I've already tried using set trace on, but I could not identify the error.
It would be great if you could help me to find the error in my code. I use the forum for the first time and hope I provided all the necessary information. I am happy to add any missing information.
Thank you very much in advance!
Code:
use dataplus.dta, replace
drop if (treat==1|treat==2)
collapse (sum) vote (mean) treat (count)n=vote, by (group totalmessage)
// Program to calculate test statistic
capture program drop meansum
program meansum, rclass
args y group
collapse (sum) `y' n, by (`group' totalmessage)
sort totalmessage `group'
gen diff=.
local p=1
while `p' < 9 {
replace diff=((`y'/n)-(`y'[`p'+ 1]/n[`p'+ 1]))*(n+n[`p'+ 1]) in `p'
local p = `p' + 2
}
return scalar summe = diff[1]+diff[3]+diff[5]+diff[7]
end
//
set seed 12345
/* stata permute command */
permute treat meansum = r(summe), reps(1000): meansum vote treat // this executes the program meansum; vote is "y" and treat is "group" in the programm
I am using permute in Stata 13.0 and Stata issues the error message "__000005 not found" which I can't interpret. I've searched the error, but only found some unrelated posts.
I've already tried using set trace on, but I could not identify the error.
It would be great if you could help me to find the error in my code. I use the forum for the first time and hope I provided all the necessary information. I am happy to add any missing information.
Thank you very much in advance!
Code:
use dataplus.dta, replace
drop if (treat==1|treat==2)
collapse (sum) vote (mean) treat (count)n=vote, by (group totalmessage)
// Program to calculate test statistic
capture program drop meansum
program meansum, rclass
args y group
collapse (sum) `y' n, by (`group' totalmessage)
sort totalmessage `group'
gen diff=.
local p=1
while `p' < 9 {
replace diff=((`y'/n)-(`y'[`p'+ 1]/n[`p'+ 1]))*(n+n[`p'+ 1]) in `p'
local p = `p' + 2
}
return scalar summe = diff[1]+diff[3]+diff[5]+diff[7]
end
//
set seed 12345
/* stata permute command */
permute treat meansum = r(summe), reps(1000): meansum vote treat // this executes the program meansum; vote is "y" and treat is "group" in the programm
Comment