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
======= 2008-05-15 02:04:39 Original Message:=======
>
>Here's a template on running loops with outreg:
>
>* data setup
>cd d:\
>sysuse auto, clear
>gen id=0
>replace id=1 in 16/45
>ren foreign year
>levelsof year
>
>* the relevant part
>foreach var in `r(levels)' {
> xi: areg price mpg turn i.rep if year==`var', absorb(id)
> outreg using myfiles, `append'
> local append "append"
>}
>
>
>Here's the original solution:
>
>http://www.stata.com/statalist/archive/2004-06/msg00231.html
>
>
>
>>Dear all,
>>
>>May I ask a novice question? I'm really new to Stata. I want to run regression
>>by year and the outreg the coefficients for each year. I want to use like :
>>by year: xi: areg score age education , absorb(nation), but stata tells me "by"
>>can not be combined with xi. Anyone has good solutions? Also I don't think
>>using by can outreg coefficients for each year.
>>
>>Many thanks in advance!
>>
>>Best,
>>
>>Martin
>
>_________________________________________________________________
>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/