Statalist


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

[utf-8] st: Re: How to run loops with outre[utf-8] g (was st: How to regress and outreg byyear?)


From   "[utf-8] Ziyang Wang" <[email protected]>
To   "[utf-8] [email protected]" <[email protected]>
Subject   [utf-8] st: Re: How to run loops with outre[utf-8] g (was st: How to regress and outreg byyear?)
Date   Thu, 15 May 2008 22:54:55 +0800

Oh, I see.. It's really a trick^^ but works perfect.

Thanks,

Martin

======= 2008-05-15 17:23:28 Original Message:=======

>
>Fixing thread index by reposting:
>
>>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/
>

= = = = = = = = = = = = = = = = = = = =
			

 

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

_____________________________________________________________________
Mensaje analizado y protegido por Telefonica Empresas


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