[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: RE: -for- versus -for each-
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
University of Sydney
* For searches and help try: