Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Eric Booth <ebooth@ppri.tamu.edu> |
To | "<statalist@hsphsun2.harvard.edu>" <statalist@hsphsun2.harvard.edu> |
Subject | Re: st: Debugging: reporting line number of loop or do-file causing error |
Date | Thu, 29 Jul 2010 12:51:59 +0000 |
<> Earlier this year, David Elliot was working on a program to enhance the debugging of programs/dofiles using macro expansion, loops, etc. He sent me a couple of versions of the ado-file for some feedback , but I don't think it ever made its way to the SSC (at least I couldn't -findit-, but maybe the SSC isn't fully operational yet?). You might contact David directly about the getting a current version of the program to see if that would be useful or not. Here is a thread where he posts an initial version of his program -dodebug-...I know he's added more functionality to the program since then, but I don't recall whether that includes the functionality you are asking about: http://www.stata.com/statalist/archive/2010-02/msg00420.html Eric __ Eric A. Booth Public Policy Research Institute Texas A&M University ebooth@ppri.tamu.edu Office: +979.845.6754 On Jul 29, 2010, at 6:05 AM, Aleksander Rutkowski wrote: > Hello, > > Is there any convenient way to make Stata report (together with an > error message) the line number of a loop or a line number of a do-file > which is causing an error? In general, I think this is an important > feature needed for efficient debugging. > > When loops are executed, the commands are not reported in the results > window, so it is difficult to quickly identify which command causes an > error. So far, I used the following solution, but it is not very > convenient: > > local i 0 > forval j = 1/100 { > local ++i > di "Now executing line `i'..." > ...some command here... > local ++i > di "Now executing line `i'..." > ...some command here... > ...etc... > } > > Alek > * > * 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/