Tell me, where did I go wrong


If you are Filipino, you are most likely singing the title by now :)

Looking for a missing bracket, a misplaced comma, or a space that shouldn’t be there—or debugging in general—can be a pain sometimes. When the usual error message fails to point out where you messed up, try turning trace on to track down the error. trace literally traces the execution of programs. It echoes the lines that Stata executes internally. Reading through the whole thing on your results window can be daunting but you don’t really have to go through those. You just need to know which line it stops executing and see why it stopped there. To turn on trace, type:

set trace on
And.. don’t forget to turn it off when you don’t need it. They can be really very long.

set trace off
Next time you wonder where you went wrong, use trace before you lose your mind. For more options, see help set trace.

Now, continue with the singing.. “what did I do to make you change your mind completely..”

 

3 Responses

  1. set tracedepth # may help avoiding going into a bottomless abyss of internal Stata code in say -ml-. Fixing the unmatched brackets is the responsibility of text editor — Stata’s built-in Do-Editor offers some help, but an external editor like WinEdt or UltraEdit are much more powerful in that regard.

  2. Time and sanity saver!

  3. goo to see you back! “…when I thought this love would never end…” 😛

Leave a Reply