Statalist


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

RE: st: Stepping through do file


From   "Buzz Burhans" <buzzb3@verizon.net>
To   <statalist@hsphsun2.harvard.edu>
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
"step". 

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
well.

Buzz



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

Email: buzzb3@verizon.net

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Michael Blasnik
Sent: Sunday, March 30, 2008 10:38 AM
To: statalist@hsphsun2.harvard.edu
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
stands 
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
file 
is not worth protecting from accidental overwriting since the original do
file 
should still exist.  If you wanted to make it optional, rather than assumed,
it 
would be easy to add REPlace as an option to the syntax statement and then 
substitute -`replace'- for -replace- in the file open command.

Michael

www.ats.ucla.edu/stat/stata/

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index