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 at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: continue loop if file not found


From   Eric Booth <ebooth@ppri.tamu.edu>
To   "<statalist@hsphsun2.harvard.edu>" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: continue loop if file not found
Date   Fri, 6 May 2011 19:50:03 +0000

<>
see -help continue-

- Eric
__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
ebooth@ppri.tamu.edu
Office: +979.845.6754
On May 6, 2011, at 2:45 PM, Patricio Cuarón wrote:

> Hello. I have a do script that loops through some .dta files with
> dates on the filename, does some math in each of them and stores the
> result in a postfile. If the loop encounters a missing file, ie
> there's a date with no .dta file associated, the loop fails on // use
> filename`date'.dta // ("file filename32.dta not found"), even if I
> call the .do file with the nostop option. Is there any way to make
> stata continue the script, iterating the loop, if no file is found?
> 
> 
> I've searched the list and used google, but I couldn't find an answer.
> This is my first stata do-file so forgiveme if I ask something
> obvious.
> 
> Thanks!
> *
> *   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