Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

Re: st: Sleep command for variable time

From   Steve Samuels <>
Subject   Re: st: Sleep command for variable time
Date   Mon, 20 Sep 2010 10:38:25 -0400

Avoid writing over data by saving each file with a different  name.
If you are creating intermediate sets for later use within the do
file, then save them as temporary files with -tempfile-.  NB: never
use "replace" as an option when saving a temporary file


Steven J. Samuels
18 Cantine's Island
Saugerties NY 12477
Voice: 845-246-0774
Fax:    206-202-4783

On Mon, Sep 20, 2010 at 9:36 AM, Jason DeBacker
<> wrote:
> I'm reading and writing large datasets over a network. It's often the case
> that Stata processes commands before a file is finished being written. This
> results in an error when Stata gets to the next command to write over the
> file, which is now read-only as it's still being written from a previous
> command. I have been using the sleep command to pause the program so the
> file can finish writing before the next command.
> My question is whether there is some way to have the time of the sleep
> command depend on the length of time is takes to write the file. What I've
> been doing is choosing a time that I think will be enough of a pause, but
> also doesn't make Stata wait unnecessarily. The problem is that sometimes
> network usage is especially high and it takes longer to write the files.
> Another way I could get around this is if there is a command to check if a
> file is completely written (or is read-only). I could then create a loop
> where I the sleep command is used for a short amount of time until the file
> is completely written.
> Thanks for your help.
> Sincerely,
> Jason DeBacker
> *
> *   For searches and help try:
> *
> *
> *

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index