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

st: RE: inner loop


From   "Nick Cox" <[email protected]>
To   <[email protected]>
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 http://www.stata.com/support/meeting/8uk/fortitude.pdf

Nick
[email protected]

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