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

Re: st: RE: -for- versus -for each-


From   Ian Watson <[email protected]>
To   Nick Cox <[email protected]>
Subject   Re: st: RE: -for- versus -for each-
Date   Thu, 8 Apr 2004 20:01:18 +1000

Dear Nick,

  Thanks for your very illuminating discussion on -for each-. I agree
  that it's a parallel list, not a nested list, issue. And you're
  right, the long-windedness was my concern. Unfortunately, my first
  posting was chopped (hence the very abrupt opening). It was
  originally sent as:

  "I realise that -for- has fallen out of favour in recent years (and
  no longer merits inclusion in the Stata manual) but I can't seem to
  get -for each- to replicate some neat aspects of -for- . I've read
  the entries in the manual and Nick Cox's piece in SJ 2 (2) but
  cannot find an answer."

  The emphasis here was on `neat'. With -for- one can execute up to 3
  processes with a single line of code, typed in on the command line
  in one go.  For that reason, I fall back on it constantly.  That's
  the facility I was looking for with -for each-, but couldn't find
  it.  Certainly, in an ado file I'd be more inclined to set up a proper
  looping structure with macros, but that's a different proposition.
  In that context, -for each- is a nice replacement to a while loop.

  Thanks for the reference to the lists article in SJ3(2). I'll follow
  it up.

-- 
Kind regards,
 Ian                          

=====================
Ian Watson
Senior Researcher
acirrt
University of Sydney
NSW 2006
Australia
======================




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