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: RE: Figure out in which do-file an error occurred


From   Oliver Jones <ojones@wiwi.uni-bielefeld.de>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: Figure out in which do-file an error occurred
Date   Thu, 08 Mar 2012 11:21:47 +0100

Hello,
the -forval- would not do the job for two reasons.

1. I call various "sub-sub-dofiles" from within the sub-dofiles.
2. (and more important) I was too simplistic in my description of
   my problem. My sub-dofiles are actucally not called like that.
   They have some meaningful names and before I call them I put
   a couple of commentary lines with a brief description of them.
   Thus looping over them would not work out.

Best
Oliver


Am 07.03.2012 20:13, schrieb Nick Cox:
You don't need to edit each file. You can change your master file to

forval i = 1/5 {
         di "beginning file `i'"
         do sub-dofile-`i'
}

Nick

On Wed, Mar 7, 2012 at 7:00 PM, Brendan Halpin<brendan.halpin@ul.ie>  wrote:
A simple but tedious strategy would be to put a line like this

-di "Beginning filename.do"-

at the start of each do-file.

If you run the master file, it will stop at the first error and you can
backtrack to the most recent "Beginning" statement.

I cope with large projects by using "make", a utility which comes with
Unix systems. Alternatively, you could use a script file (something.bat
in Windows, a shell-script file in Unix-like systems). This involves
using Stata in batch mode. However, since Stata batch jobs tell the
operating system they have completed successfully even if there has been
a Stata error, these script files will continue regardless even when
an error occurs in an earlier do-file. I wrap the call to Stata in a
script file which searches the log file for errors. I describe the
system in more detail at
http://teaching.sociology.ul.ie/bhalpin/wordpress/?p=122

Brendan
--
Brendan Halpin,   Department of Sociology,   University of Limerick,   Ireland
Tel: w +353-61-213147  f +353-61-202569  h +353-61-338562;  Room F1-009 x 3147
mailto:brendan.halpin@ul.ie    ULSociology on Facebook: http://on.fb.me/fjIK9t
http://teaching.sociology.ul.ie/bhalpin/wordpress         twitter:@ULSociology
*
*   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/

--
Universität Bielefeld
Fakultät für Wirtschaftswissenschaften
Lehrstuhl für Ökonometrie und Statistik
- -
Bielefeld University
Faculty of Business Administration and Economics
Chair of Econometrics and Statistics
- -
Raum / room:  V9-108
Tel / phone:  +49 (0)521 106 4895
- -
http://www.wiwi.uni-bielefeld.de/oekonometrie.html
---
*
*   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