Allan is travelling down a beaten path.
. ssc desc sto
--------------------------------------------------------------------------------------------------
package sto from http://fmwww.bc.edu/repec/bocode/s
--------------------------------------------------------------------------------------------------
TITLE
'STO': module to toggle trace switch
DESCRIPTION/AUTHOR(S)
sto (set trace on/off) toggles the current setting of the trace
switch. This is useful only in Stata 6 or Stata 7. In Stata 8,
set trace is pushed and popped within a program, meaning that
sto has no effect beyond its own termination, and thus no
useful consequence.
KW: programming
KW: set trace
Requires: Stata version 6.0 (not 8.0)
Author: Nicholas J. Cox, University of Durham
Support: email [email protected]
Distribution-Date: 20030326
INSTALLATION FILES (type net install sto)
sto.ado
sto.hlp
------------------------------------------------------------------------------------------------
(type -ssc install sto- to install)
What is more, you can't work around this by using -version-
control.
I am not sure IF this is documented anywhere.
Perhaps StataCorp would consider a wired-in command, say
-sto-, which toggles -trace- on and off, as I agree with
Allan: typing the full commands repeatedly in a prolonged
debugging session is a little tedious.
Otherwise Michael Hanson's idea is the best I can come up with.
Nick
[email protected]
Allan Garland
> I have what should be a very simple Stata programming
> question that is vexing me.
>
> I'm use the debugging command -trace- a lot and am annoyed by
> having to
> type "set trace on" and "set trace off" over and over from
> the command
> prompt. So, I tried to make a simple pair of ado files that would do
> that for me but with less typing, i.e. new commands -ton- to
> turn trace on, and -tof- to turn trace off:
>
> capture program drop ton
> program define ton
> version 9.1
> set trace on
> end
>
>
> capture program drop tof
> program define tof
> version 9.1
> set trace off
> end
>
> However, when I run these it doesn't have the desired effect. In
> particular, I found that if I add Stata commands to the ado
> file -ton-
> after the line "set trace on" that indeed it traces them.
> But once it
> finishes reading and executing -ton-, trace seems to be set back to
> OFF. Thus, these "set trace" commands given with the ado files don't
> seem to "stick" after the ado file execution is completed.
*
* 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/