0
votes

I'm running a long list of regressions in Stata. Results are exported using outreg2. At random points in time, the execution stops at some outreg2 with the error file handle __00000G not found. When I rerun the whole exercise it works after some tries. Do you have any idea what could be the reason? My code looks as follows where further regressions of the same type follow.

xtreg l_GDP_capita i.year date_intens, fe r

outreg2 using year_DG_FE_gdp, excel append label addtext(DG FE, YES, YEAR FEs, YES) drop(i.year) ctitle(log GDP per capita, AP) replace

xtreg l_GDP_capita i.year date_intens if any_lez==1, fe r

outreg2 using year_DG_FE_gdp, excel append label addtext(DG FE, YES, YEAR FEs, YES) drop(i.year) ctitle(log GDP per capita, LEZ)

2
On Statalist it is policy to explain where user-written files come from, and that is a good idea here too. outreg2 is from SSC. Unfortunately you don't seem to have either a reproducible example for us or even a reproducible problem for yourself with your own data. I'd advise contacting the program author directly.Nick Cox
In the meantime, you can try estout, also from SSC.Roberto Ferrer

2 Answers

0
votes

Two thoughts:

(1) your file name needs to be in quotations, so outreg2 using "year_DG_FE_gdp", [blah] instead of outreg2 using year_DG_FE_gdp, [blah].

(2) In case you haven't done so, you need to set a directory. cd "whatever filepath you want to save to" (or a global directory if you want to get fancy). You may have done this earlier in your code (I usually do it at the top of a .do file), but since you've only posted the snippet here I can't tell. Forgetting it is one of the classic problems people tend to have with outreg.

0
votes

Not 100% sure, but I am having the same problem and I think this may arise when outreg2 is writing to a directory that is being synced (e.g. Dropbox, Google Drive). I believe the conflict may come from a permissions conflict where Stata is trying to change the file as the sync software is uploading the change. If you can pause the syncing of the directory while running the Stata commands, this seemed to help me.