Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: Sleep command for variable time


From   Steve Samuels <sjsamuels@gmail.com>
To   statalist@hsphsun2.harvard.edu
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
(http://www.stata.com/statalist/archive/2007-08/msg01124.html)

Steve

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

On Mon, Sep 20, 2010 at 9:36 AM, Jason DeBacker
<jason.debacker@gmail.com> 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:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index