Statalist


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

Re: st: Stepping through do file


From   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   Re: st: Stepping through do file
Date   Sun, 30 Mar 2008 10:37:38 -0400

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


----- Original Message ----- From: "Buzz Burhans" <[email protected]>
To: <[email protected]>
Sent: Saturday, March 29, 2008 8:25 PM
Subject: RE: st: Stepping through do file



Michael,

-addpause- works very well.  It advances the -do- file execution a few lines
and allows me to check the data at every pause -Nice!

I have tried to modify it to do two additional things, but I have not been
able to succeed:

I tried to add a line number to the added pause when each is written, but I
must be missing something because I could not get it do so. (I tried to use
the content of `lnum' and _n after the "pause".)  When I previously added
the pauses manually I added them as:

"pause L10" or Lxxx

When the pause occurred this allowed me to see where (line number) I was
pausing and find the section of the script in the -do-file prior to that
pause.

The other thing I tried to do was add a " ,replace" to the creation of the
new file with the "_pause"  suffix.

These are not big problems, but if you could look at if they could be added
to your -addpause- without much effort I would be very grateful.

Once this thread is in the archives I'm glad others will be able find your
code for -addpause- -it is a great help in addressing the problem I started
the thread with of stepping through a -do- file.

If StataCorp is listening, it would be a great advantage to be able to open
a -do- file in the -do- file editor and "step" through it. It is problematic
to step through highlighted lines in the editor because the temps and macros
are lost when only blocks of code are run from a longer -do-file.

Thanks Michael.  Your -addpause- utility is very helpful!

Buzz

Buzz Burhans, Ph.D.
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index