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

st: loop


From   "Jun Xu" <mystata@hotmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: loop
Date   Fri, 07 Feb 2003 21:31:22 -0600

Dear all listers:

puzzled by a problem when writing an ado file. Suppose I have
var1 var2 var3 var4 var5......vark, and I want to do the following loop:
*********************************************************************
var1
var2
var3
...
...
...
vark
var1 var2
var1 var3
var1 var4
...
...
var1 vark
var2 var3
var2 var4
...
...
var(k-1) vark
...
...
var1 var2 var3
var1 var2 var4
var1 var2 var5
...
var1 var2 var3....vark
******************************************************************
Basically, what I want to do is like step wise exhausting all combinations in a systematic way from univariate, bivariate, trivariate, to multivariate....Or, I can say for every variable in the variable list, there is indicator variable associated with it. I either take this variable in or out in each run. And there should be 2^k possibilities. I have no idea how to handle that. COuld anyone give me some hint? Many thanks in advance.

Jun Xu
Department of Sociology
Indiana University at Bloomington



_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail

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