-outreg2- is a user-written program (Roy Wada, SSC).
Broadly speaking, my guess is that the explanation is nothing to do with
either the official Stata commands you use or -outreg2-. It will be a
matter of how that directory is set up within Windows. I know this
contradicts what you say, but it's still my guess, because I can't think
of a better one.
So I'd seek an explanation the operating system end.
I've known Windows decide -- utterly capriciously, from my point of
view, although presumably it was a consequence of something I did --
that a particular directory was read-only.
The fact that you report that this "sometimes" happens seems consistent
with that guess.
Conversely, if this were a bug in the commands mentioned, all heavily
used, it would have been reported long since.
Nick
[email protected]
kokootchke
Sometimes when I run do files in which I try to save, replace or modify
a file in some way, Stata thinks that this file is read-only when it
shouldn't be.
The problem I'm having right now is the following:
I am running a do file that contains a bunch of lines like:
foreach y of varlist happ job{
regress `y' lrwage lrwager firm_l if female==1, cluster(unm)
estimates store Self0
regress `y' lrwage lrwager firm_l firm_iqr if female==1,
cluster(unm) estimates store Self1
...
outreg2 lrwage lrwager firm_l firm_iqr [Self0 Self1 ...] using
myfile_`y', replace bdec(2) label nocons excel}
When I do the file, I notice that Stata shows in the display window the
results for all the regressions but when it reaches the outreg2 command,
it gives the following error:
file myfile_happ.txt is read-only; cannot be modified or erasedr(608);
And I get this error whether myfile_happ.txt exists in the directory or
not. Also, sometimes I only get this error for the SECOND time Stata
goes through the loop; that is, the first time it goes through and it
does save the file myfile_happ.txt but the second time it stops and it
fails to save the file myfile_job.txt!!! What do you think is going on??
Another thing that happens often -- but I'm not having this problem
right now -- is that I run a do file that contains a line such as:
save, replace
and it fails to save the file because it is apparently read-only. What
is even stranger is that some other times, it does go through and saves
the file normally.
I have already verified that my folder where my files are in Windows is
not read-only, but that doesn't help.
I am running Stata 9 SE on Windows XP Pro... but I think I have also
seen this error when I've run my code on a different computer with Stata
10 SE.
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/