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

RE: st: Stepping through do file

From   "Buzz Burhans" <>
To   <>
Subject   RE: st: Stepping through do file
Date   Mon, 31 Mar 2008 10:01:54 -0400

Dear StataCorp,

I'd like to suggest a utility be added to Stata that would work similarly to
the -trace- utility now in Stata.  The utility would be an extension of the
nifty and very useful -stepdo- utility that Michael Blasnik wrote earlier in
this thread.  

The extended capabilities that would be useful would be to allow it to
continue stepping through a -do- file nested and called within the first
-do- file, and also to allow setting the size (i.e. number of lines) of the

The idea would be that much like -set tracedepth X- and -set trace on- the
user could -set step X- (X being the number of lines between each pause) and
then -set step on- .  Perhaps instead of using 'q' to advance it could allow
the spacebar to advance the file execution the next step, somewhat like
after -more-.  If it is considered, please also implement it so that it
echoes the line number where each step pauses -that is quite useful.  If you
allow it to step through nested files, it would also be useful to have it
echo the -do- file name with the line number at each step -in some of my
work before I had Michael's -stepdo- I was manually adding pauses to allow
me to inspect the output -but I added (manually) the -do- file name to each
pause message because I was sometimes at a nested level, and the line no.
alone didn't tell me where I was paused. 

Michael Blasnik's utility has been very very helpful, and I am grateful for
his effort to write it.  I suspect others will find it useful at times as


Buzz Burhans, Ph.D.

Dairy-Tech Group

Twin Falls, ID
Phone: 208-320-0829
Fax: 208-735-1289 

So. Albany VT
Phone: 802-755-6842


-----Original Message-----
[] On Behalf Of Michael Blasnik
Sent: Sunday, March 30, 2008 10:38 AM
Subject: Re: st: Stepping through do file

Glad to hear that it works.

To add a line number to the pause message you can change just one line:

file write `new' "pause" _n

should become

file write `new' "pause `lnum'" _n

The _n in these commands is not the _n observation index, but is actually
for _newline, placing a line end character in the output.

With regard to adding a replace option, addpause automatically replaces the 
pause version of the do file -- I assumed that the pause version of any do
is not worth protecting from accidental overwriting since the original do
should still exist.  If you wanted to make it optional, rather than assumed,
would be easy to add REPlace as an option to the syntax statement and then 
substitute -`replace'- for -replace- in the file open command.


*   For searches and help try:

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