Dear all,
Please set aside your time to look at my program.
I try to run the program on bootstraping eventually to obtain the standard deviation of "att"(average treatement effect on treated). In addition my att is computed with controlling for the "year" variable to control for unobserved time effects.
Somehow the output reports
command -> withinyear
an error occurred when command was executed on original dataset
please rerun bootstrap and specify the trace option to see a trace of the commands bootstrap executed
r(198);
I have no clue what goes wrong with this.
My do-file is the following..
adopath + c:\
bootstrap withinyear, reps(500) saving(c:\results) replace
My program is version 8.2 (last updated). my "ado" file is also saved in c:\.
program define withinyear
version 7.0
if "`1'" == "?" {
global S_1 "a1"
exit
}
tempvar x y0
tempname att
capture{
psmatch2 D1 x1 x2 x3 if year==1999, ate logit out( y)
rename _y `y0'
psmatch2 D1 x1 x2 x3 if year==2000, ate logit out( y)
replace `y0'=_y if year==2000 & _treated==1
psmatch2 D1 x1 x2 x3 if year==2001, ate logit out( y)
replace `y0'=_y if year==2001 & _treated==1
psmatch2 D1 x1 x2 x3 if year==2002, ate logit out( y)
replace `y0'=_y if year==2002 & _treated==1
gen `x'=y -`y0'
summarize `x'
scalar `att'=r(mean)
}
if _rc==0 {post `1' (`att')}
end
I thank you all very much for spending time to assist me.
Many thanks,
Pan
*
* 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/