I have 224 variables (e1,e2...e224) and I want to bootstrap the critical values for each one of them. I have been trying for some time and here is the code;
program define Boot, rclass
bsample
local j 1
while `j' <= 224 {
centile e`j', centile(.5 2.5 5 95 97.5 99.5)
return scalar CV1`j'=r(c_1)
return scalar CV2`j'=r(c_2)
return scalar CV3`j'=r(c_3)
return scalar CV4`j'=r(c_4)
return scalar CV5`j'=r(c_5)
return scalar CV6`j'=r(c_6)
local j = `j' + 1
end
local i = `i' + 1
while `i' <= 224 {
bootstrap CV1`i'=r(CV1`i') CV2`i'=r(CV2`i') CV3`i'=r(CV3`i') CV4`i'=r(CV4`i') CV5`i'=r(CV5`i') CV6`i'=r(CV6`i'), reps(50) nodots: Boot
local i = `i' + 1
}
While the code works well when I specify one variable, for example e1, it does not work with the macro. I am not sure what is wrong with this code.
Thanks
Lilly
program define Boot, rclass
bsample
local j 1
while `j' <= 224 {
centile e`j', centile(.5 2.5 5 95 97.5 99.5)
return scalar CV1`j'=r(c_1)
return scalar CV2`j'=r(c_2)
return scalar CV3`j'=r(c_3)
return scalar CV4`j'=r(c_4)
return scalar CV5`j'=r(c_5)
return scalar CV6`j'=r(c_6)
local j = `j' + 1
end
local i = `i' + 1
while `i' <= 224 {
bootstrap CV1`i'=r(CV1`i') CV2`i'=r(CV2`i') CV3`i'=r(CV3`i') CV4`i'=r(CV4`i') CV5`i'=r(CV5`i') CV6`i'=r(CV6`i'), reps(50) nodots: Boot
local i = `i' + 1
}
While the code works well when I specify one variable, for example e1, it does not work with the macro. I am not sure what is wrong with this code.
Thanks
Lilly
Comment