Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Zeynep Ozkok <zeynepozkok@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: creating loops using combinations of variables |

Date |
Thu, 16 Feb 2012 10:14:25 +0100 |

Hi, I have a question on how to create loops for combinations of different variables. I have 27 variables that I would like to put in two different indices. The indices can be constructed in two steps: Lex1=sum(of different variables out of 27) this variable should be able to take on 1 to 27 variables, so it should allow for all possible combinations. It could be equal to only 1 variable, or it could be equal to the sum of different variables Index1 = ln (1+lex1) this index is then dependent on what values lex1 takes on Similarly Lex2 = sum (of all the variables that are not accounted in lex1) again this could take on one variable, or more than one depending on the structure of lex1. Index2 = ln(1+lex2) this index is once again dependent on what values lex2 takes on, which is dependent on the values that lex1 takes on. Then these two indices will simultaneously be used in fixed effects regressions as follows: Y_i,s,t= alpha_i +alpha_s +alpha_t +beta*(index1)_i,t +lamda* (index2)_i,t + error_i,s,t The loop must go on until all possibilities/ combinations are completed. I need to check the results of the beta and lamda coefficients and their corresponding rsquares for each regression. Since there are numerous possibilities in constructing each index I need to create a loop. However I don't even know how to start out a loop that depends on combinations of variables. Could you possibly help me out in writing and solving this problem? Thank you very much. Zeynep * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**st: RE: creating loops using combinations of variables***From:*Nick Cox <n.j.cox@durham.ac.uk>

- Prev by Date:
**Re: st: Composite measures** - Next by Date:
**Re: st: Test of parameter equality between two seemingly unrelated regressions** - Previous by thread:
**st: Meta-analysis pooling relative risk from relative risks possible?** - Next by thread:
**st: RE: creating loops using combinations of variables** - Index(es):