Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: -outreg- in a loop


From   Nishant Dass <[email protected]>
To   [email protected]
Subject   Re: st: -outreg- in a loop
Date   Mon, 18 Sep 2006 05:11:34 -0700 (PDT)

Thank you very much Dimitriy!

Your suggestion was very helpful.  I ran my original code
but modified it as per your suggestion regarding "\`".

Using my earlier example, here's how I re-ran my code:

foreach X in x y z {
      reg a `X'
      outreg a `X' using "D:\/`X'.txt", replace
}

This was really great!

Nishant 





--- "Dimitriy V. Masterov" <[email protected]> wrote:

> I would do something like this if you want your
> regressions bundled together:
> 
> local append "replace"
> 
> foreach X in x y z {;
> reg a `X;
> outreg using "D:/filename.out", title("Reg of a on `X'")
> bdec(4)
> coefastr se 3aster addnote("Note here") `append';
> local append "append";
> };
> 
> If you want them separately, do
> 
> local append "replace"
> 
> foreach X in x y z {;
> reg a `X;
> outreg using "D:/`X'.out", title("Reg of a on `X'")
> bdec(4) coefastr
> se 3aster addnote("Note here") `append';
> local append "append";
> };
> 
> The problem with using a backslash in the path name is
> that it has
> special meaning when combined with a single quote. It
> means don't
> expand the macro, which is why you're running into a
> problem.
> 
> DVM
> *
> *   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/
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index