Bookmark and Share

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


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

Re: st: Sleep command for variable time


From   Steve Samuels <[email protected]>
To   [email protected]
Subject   Re: st: Sleep command for variable time
Date   Tue, 21 Sep 2010 13:02:26 -0400

I  see that my post  didn't respond to Jason's question.  One
possibility, which I haven't tried and might not work:  -capture-
(Maarten's suggestion) the next command, which could be a dummy, in a
-while- block,  until _rc  =0

Steve




On Mon, Sep 20, 2010 at 10:38 AM, Steve Samuels <[email protected]> wrote:
> 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
> [email protected]
> 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
> <[email protected]> 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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index