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]
st: looping twice over same variables without repeating results
From 
 
Beatriz Rodriguez Prado <[email protected]> 
To 
 
[email protected] 
Subject 
 
st: looping twice over same variables without repeating results 
Date 
 
Fri, 18 May 2012 11:52:14 +0200 
Hello,
I need some help with this situation.
I have 3 variables named pmm_and pmm_ext pmm_es and I want to make 
simple regressions of each pair of variables.
I have writen this code
foreach x in and ext es {
    foreach y in and ext es{
        if pmm_`x'!=pmm_`y' {
        regres pmm_`x' pmm_`y'
        }
    }
}
How could avoid to run repeated regressions?
In fact I have 50 variables and have to run regressions, test some 
hyphotesis and make graphs and the output of the loop is unnecesary big.
Thank you very much
Beatriz Rodriguez
*
*   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/