[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Stata thinks files are read-only when they shouldn't be!

From   kokootchke <>
To   statalist <>
Subject   st: Stata thinks files are read-only when they shouldn't be!
Date   Fri, 8 May 2009 23:52:38 -0400

Dear all, 
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.

Thank you very much!!!

Windows Live™: Keep your life in sync.
*   For searches and help try:

© Copyright 1996–2020 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index