Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Programming advice on generating loops


From   "Le Wang" <statauser@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Programming advice on generating loops
Date   Wed, 2 Apr 2008 00:09:25 -0500

Hi there,

I need to generate loops according to the number of variables (unknown
beforehand) in the ado program.

For example, if one uses two variables, then I want to do the following loop

forvalues i=1/10{
      forvalues j=1/32{

      .......

      }
}


if one specifies three variables, then the loop looks like this

forvalues i=1/10{
      forvalues j=1/32{
            forvalues k=1/47{

            .......
            }
      }
}

and so on....

How can I do this? Thanks in advance.

Le

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Le Wang, Ph.D.
Minnesota Population Center
University of Minnesota
(o) 612-624-5818
*
*   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