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