Hello,
I have encountered a strange problem (at least for me). I run a loop of the following form to generate a distribution of adjusted R2s (can't use the bootstrap command for reasons irrelevant here):
clear
save "XY", replace emptyok
forvalues i = 1/1000 {
display `i'
use "XYZ" , clear
bsample 1000
quietly: reg xy
clear
save "helpfile", replace emptyok
set obs 1
gen ar2_xy =.
replace ar2_xy = e(r2_a)
save "helpfile", replace
use "XY", clear
append using "helpfile"
save "XY", replace
}
The code works in principle and sometimes runs through smoothly, but most times after a random number of iterations gives me:
(...)
109
(note: dataset contains 0 observations)
file helpfile.dta saved
number of observations (_N) was 0, now 1
(1 missing value generated)
(1 real change made)
file helpfile.dta saved
file XY.dta saved
110
(note: dataset contains 0 observations)
file helpfile.dta cannot be modified or erased; likely cause is read-only
directory or file
r(608);
end of do-file
Why would the file suddenly be read-only? And as I said, sometimes it does finish all 1000 iterations without error.
Thanks a lot for your help!
Ferdinand
Related Posts with Sudden r(608) error in a loop (file cannot be modified)
Why do I get different results for fe and gmm2s estimation using (xt)ivreg2?Dear Statalisters, I am trying to analyze the relationship between corruption and the distribution …
Why do I get different results for fe and gmm2s estimation using (xt)ivreg2?Dear Statalisters, I am trying to analyze the relationship between corruption and the distribution …
Testing for serial correlation between the interest rate and its lagsHello everyone, When including the interest rate into my time series model against the exchange rat…
Plotting Groups of Fixed Effects Coefficients, By Group, By YearHello all, I realize my title might be a little dizzying, but I wasn't sure how else to phrase it. …
estimating dynamic panel data models when the data set features a moderate N and moderate T.What are the methods of estimation that can be used when the data set features a moderate N and mode…
Subscribe to:
Post Comments (Atom)
0 Response to Sudden r(608) error in a loop (file cannot be modified)
Post a Comment