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)
A package for Nearest Neighbor estimation with panel data?Hello. I'm trying to estimate an effect using panel data with three time periods (0, 1 and 2). Time …
ml command with estimated coefficients (rangestat/runby?)Dear All, Given the data set Code: * Example generated by -dataex-. To install: ssc install dataex…
Add leading zero before decimal in scalarsDear All, I am writing to ask a quick question on making a small adjustment to scalars. Code: sy…
xtreg, xtgls, xtpcse, OR xtregar?Hello, I am trying to estimate the effect of state law on number of crashes relative to total vehic…
PPML estimation issueDear Statalist I am attending to estimate gravity model of trade of Morocco in my thesis, in order t…
Subscribe to:
Post Comments (Atom)
0 Response to Sudden r(608) error in a loop (file cannot be modified)
Post a Comment