Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: tracedepth question


From   "Julian Reif" <[email protected]>
To   "Statalist \(E-mail\)" <[email protected]>
Subject   st: tracedepth question
Date   Mon, 29 Jan 2007 09:38:17 -0500

All,

I often write code that contains very long for loops, e.g.

forval x = 1/100 {
	[hundreds of lines of code]
	...
}

If there is an error somewhere in the loop, Stata reports the error type but does not tell me what line it occurred on. To get around this, I frequently execute the command -set trace on-, which will tell you exactly what line of code the error occurred on. However, trace by default steps into each command (and subcommand) called inside the loop. This slows down execution and also displays lots of information I don't care about. Executing -set tracedepth 1-, which instructs Stata to only step down one level into each command, mitigates the situation but still displays more information than I'd like.

What I want to be able to do is to -set tracedepth 0-, which would trace the lines of my for loop without stepping into all the commands, but Stata does not allow this. Is there a technical reason why this is so? Are there any alternatives (besides writing lots of -display- lines)?

Julian

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index