Bookmark and Share

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: loop question


From   "arosella" <[email protected]>
To   "Statalist" <[email protected]>
Subject   st: loop question
Date   Tue, 17 Dec 2013 11:15:40 +0100

Dear Statalisters,
this is sure a trivial question but the loop below doesn't save the file
1_2_dieta


 local k = 1
forval i = 1/37 {
    foreach j of numlist 2 3 4 5 {
        if `k' == 1 {
            import excel `i'_`j'_dieta, sheet("Sheet1") firstrow clear
        }
        else {
            save `i'_`j'_dieta, replace
        }
        local k = `k' + 1
    }
}
Can someone help me?
Thanks 
 
Alberto R. Osella
Laboratorio di Epidemiologia e Biostatistica
IRCCS Saverio de Bellis
Via Turi, 27
70013 Castellana Grotte (BA)
Italia
tel: +39 0804994655
fax: +39 0804994650
e-mail: [email protected]

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index