Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Michael Norman Mitchell <Michael.Norman.Mitchell@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: log file recording within loops |

Date |
Sat, 20 Mar 2010 15:04:21 -0700 |

Dear Jan

DO REPEAT Q=Q1 TO Q5/ R=R1 TO R5. COMPUTE Q=0. COMPUTE R=1. END REPEAT PRINT. I sometimes will fake this in Stata by typing, at the command window . set trace on . set tracedepth 1 and then the contents of the loops are displayed, e.g. --- test.do --- sysuse auto, clear foreach v of varlist m* { summarize `v' } ---- test.do --- do test . sysuse auto, clear (1978 Automobile Data) . foreach v of varlist m* { 2. summarize `v' 3. } - foreach v of varlist m* { - summarize `v' = summarize make Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- make | 0 - } - summarize `v' = summarize mpg Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- mpg | 74 21.2973 5.785503 12 41 - } . end of do-file Michael N. Mitchell See the Stata tidbit of the week at... http://www.MichaelNormanMitchell.com On 2010-03-20 1.44 PM, Jan Stuhler wrote:

Dear all,a question on log-files. Stata does not log any commands that areinside loops (it only logs the results/output). Since loops areusually all over in my do-files I end up having a long list ofuninformative notices in my log-files.I know that most people add comments (e.g. "di ....") in theirdo-files in order to keep track at which part of the loop theirlog-file is recording. I do not like this solution since it means alot of additional typing and a potential source of typos. Is there anyother solution, e.g. some sort of "noisily" command that forces Statato log commands within loops?Many thanks for any answers, Jan * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

* * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: log file recording within loops***From:*Jan Stuhler <janstuhler@googlemail.com>

**References**:**st: log file recording within loops***From:*Jan Stuhler <janstuhler@googlemail.com>

- Prev by Date:
**st: RE: RE: RE: RE: Bootstrap Error** - Next by Date:
**RE: st: Estout after xtmixed with ar(1) residuals** - Previous by thread:
**st: log file recording within loops** - Next by thread:
**Re: st: log file recording within loops** - Index(es):