Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error code 3621: attempt to write read-only file-possible workaround?

    Hi all,

    I've had problems running do-files where Stata seems to get stuck writing something to a file. For example, recently I've been using multiple imputation in wide format and performing various commands using the mi passive or mi xeq prefix. This error also occurs as something like "file _4___mitmpfile2.dta cannot be modified or erased; likely cause is read-only directory or file
    r(608);"

    In most cases, I've found that using one of Sterling Archer's favorite expressions helps. I go back to the do-file and add the command "display "Wait for it..." and this seems to give the system a little time to catch up.

    It might be that I'm using a pretty fast computer and writing to Dropbox, but whatever the case, this seems to work. If there's a way to actually prevent it, I'd love to know.

    Michelle
    Sterling Archer.

  • #2
    Two things have worked for me.

    sleep # causes it to pause execution, which if placed in the right spot can help.

    The other is to deliberately delete files even when I'm using the ",replace" option for something. As far as I can tell, for some commands sometimes, the replace option simply doesn't delete the old file in time. So I put "capture rm filename" before invoking the command that would write to the file. In your case, depending on what you're doing with mi and how the file(s) are named, it may or may not be a solution. Manually cleaning out files you intend to over-write should achieve the same thing.



    Comment

    Working...
    X