<>
In such cases, I either look at the error very closely and try to figure out
which command could possibly have caused it - most of the time that narrows
it down quite substantially. Or I let my template below record the entire
-trace- with -tracedepth- at infinity (grab a cup of tea in the meantime),
have it turned into a pdf and search it in the pdf reader for the offending
command...
*************
//to log in an additional log and have it transferred to pdf
//can set -linesize-
set linesize 120
//close if open
capt log close newlog
di in red _rc
log using mylog.smcl, name(newlog) replace
//do whatever you want in the log
//trace the thing with Ben Jann`s tool
//tr:
//or use conventional set trace on/off
//set trace on
//set trace off
log close newlog
//translate
translate mylog.smcl mylog.ps, replace
//need Miktex utilities running on computer for this step
!ps2pdf mylog.ps
capt erase mylog.ps
!start mylog.pdf
*************
HTH
Martin
-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von John Bates
Gesendet: Dienstag, 5. Mai 2009 18:41
An: Stata
Betreff: st: Tracing in Stata
<>
Hi,
Is there any way to figure what line in a for loop Stata is erroring on?
The best way I know of is to do -set tracedepth 1- and -set trace on-. This
works, BUT it's annoying because Stata traces down into function calls that
I don't care about. For example, assume there is an error somewhere in the
following (potentially very long) for loop:
forval x = 1/20 {
regress...
probit....
...
}
I just want to know which line in the for loop the error is without having
trace go down into the regress ADO code etc. This is not a problem outside
of the for loop because Stata goes line-by-line down do files by default.
All in all, a very minor issue, but one that frustrates me. Ideally there
would be a -set tracedepth 0- option which would address this.
Lirac
*
* 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/