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]

Re: st: Looping or macro needed???


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: Looping or macro needed???
Date   Thu, 2 Jun 2011 21:02:46 +0100

A loop could be

foreach s in aaa bbb ccc ddd eee fff ggg hhh {
       use  "P:\ProjectName \Mat070809_`s'.dta, clear
       ...
}

Nick

On Thu, Jun 2, 2011 at 8:38 PM, Jennifer A Hoff
<[email protected]> wrote:
> I am running a regression and calculating a couple of difference in
> difference using data set Mat070809_aaa.
>
> Ie.    use "P:\ProjectName \Mat070809_aaa.dta"
>
> I have the do file up and working for this one dataset.
>
>
> I now need to repeat the same regression for 7 more data sets
> Mat070809_bbb, Mat070809_ccc, Mat070809_ddd, Mat070809_eee, Mat070809_fff,
>
> Mat070809_ggg, Mat070809_hhh
>
> I am a very new Stata user but it seems to beg for some type of looping or
>
> macro.
>
> Especially when I anticipate having to re-run each of the 8 regressions
> with 3 strata!  - Running 24 separate do files seems inefficient.
>

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


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