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]

st: Sleep command for variable time

From   Jason DeBacker <>
Subject   st: Sleep command for variable time
Date   Mon, 20 Sep 2010 09:36:01 -0400

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.

Jason DeBacker
*   For searches and help try:

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