Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: foreach command


From   "Scott Merryman" <smerryman@kc.rr.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   Re: st: foreach command
Date   Sun, 15 Jun 2003 20:21:19 -0500

----- Original Message ----- 
From: "Fred Wolfe" <fwolfe@arthritis-research.org>
To: <statalist@hsphsun2.harvard.edu>
Sent: Sunday, June 15, 2003 6:32 PM
Subject: Re: st: foreach command


> >Note that you lose any sense of what the dependent variable is. Instead,
> >the log simply lists t-test after t-test. Is there any way we can bring
> >back some marker of the command Stata repeats?
>
> I have always thought Stata ought to have an -echo- option to deal with
> problem. But the best you can do is:
>
> foreach var of varlist a b c {
> di"`var'"
> test `var',by(catvar)
> }
>
> It is kind of a pain in the neck.
>
> Fred Wolfe

One problem with the -for- command is that there was some ambiguity in how
backslashes were interpreted.  See "Stata 7: Why do some nested for commands
produce an error?" (http://www.stata.com/support/faqs/lang/nestfor.html)

Scott





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