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

st: RE: inner loop

From   "Nick Cox" <>
To   <>
Subject   st: RE: inner loop
Date   Mon, 4 Nov 2002 10:43:12 -0000

Hans J. Baumgartner
> is it possible to run an inner loop using the for command?
> I think it is
> not possible but could someone point me to a command that allows for
> such an inner loop?
> What I would like to do is basically the following:
> for any a b c: for num 1984/2000: replace z=YX

There have been several threads touching on this
over the last few months on Statalist.

In essence, nested -for- sometimes works, but
it is not guaranteed to work.

I don't understand this example, but -forvalues-
and -foreach- nest very well and are strongly
recommended for nested problems.

There is a tutorial in Stata Journal 2(2), 202-222 (2002);
if you do not have access to SJ, the substance of that is
accessible at


*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index