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

From |
Roy Wada <roywada@hotmail.com> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
How to run loops with outreg (was st: How to regress and outregbyyear?) |

Date |
Thu, 15 May 2008 01:57:46 -0700 |

>Hi Roy Wada, > >I see this solution, but not so sure how does the following two lines work: > outreg using myfiles, `append' > local append "append" > >Can anyone please explain a little? In the first line, without previous definition > of append, what's their initial value? what if in the first loop I want to use >"replace" option, and in the following I want to use "Append"? > >Thanks, > >Martin It's an old trick that makes a clever use of macros. See Nick Cox's explanation here: http://www.stata.com/statalist/archive/2004-06/msg00238.html When the loop runs the first time, `append' takes null value, meaning empty space. -outreg- sees nothing. During the subsequent loops, it will see "append". If it makes it easier for you, then the example can be adjusted the following way by adding -local append "replace"- * the relevant part local append "replace" foreach var in `r(levels)' { xi: areg price mpg turn i.rep if year==`var', absorb(id) outreg using myfiles, `append' local append "append"> } In fact, this is how values are passed between subroutines within -outreg-. Roy _________________________________________________________________ Get Free (PRODUCT) RED™ Emoticons, Winks and Display Pics. http://joinred.spaces.live.com?ocid=TXT_HMTG_prodredemoticons_052008 * * 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/

- Prev by Date:
**Re: Re: st: How to regress and outreg by year?** - Next by Date:
**Re: st: Too many decimal places for ODBC - thanks** - Previous by thread:
**st: Is there an ideal do file editor?** - Next by thread:
**Re: st: Too many decimal places for ODBC - thanks** - Index(es):

© Copyright 1996–2022 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |