# Re: Re: st: How to regress and outreg by year?

 From "Ziyang Wang" To "statalist@hsphsun2.harvard.edu" Subject Re: Re: st: How to regress and outreg by year? Date Thu, 15 May 2008 13:46:21 +0800

```Dear all,

Thank you all for reply. I also find a way using macro, like

local j =1995;
while `j'<=1997{;
xtreg div size debtratio if year==`j', i(nation_code) re;
outreg2 using test.xls, label se nocon symbol(***, **, *) alpha(0.01, 0.05, 0.10) addstat(chi-square test, r(chi2)) append;
local j = `j' + 1;

};

I have a follow up question, I tried to output the wald chi square like the above command but failed.. Could someone help me on how to output the chi square? Also I'd like to output the significant level associated with it? Anyone knows?

Thanks!

Martin

======= 2008-05-15 04:25:24 Original Message£º=======

>Try -eststo- and -esttab- from the -estout- package (-ssc describe
>estout-). Example:
>
>. sysuse auto
>. keep if rep>=3
>. generate year = 2007+(uniform()<.5)
>. xi: bysort year: eststo: reg price mpg i.rep78
>(output suppressed)
>
>. esttab, mtitles nonumber
>
>--------------------------------------------
>                     2007            2008
>--------------------------------------------
>mpg                -298.7**        -227.3**
>                  (-3.15)         (-2.82)
>
>_Irep78_4          -494.9           795.2
>                  (-0.39)          (0.82)
>
>_Irep78_5          2315.8           335.7
>                   (1.35)          (0.28)
>
>_cons             12948.2***      10451.9***
>                   (6.18)          (6.48)
>--------------------------------------------
>N                      29              30
>--------------------------------------------
>t statistics in parentheses
>* p<0.05, ** p<0.01, *** p<0.001
>
>. eststo clear
>
>ben
>
>
>On Wed, May 14, 2008 at 6:04 PM, Ziyang Wang <wzmartin@ust.hk> wrote:
>> 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.
>>
>>
>> Best,
>>
>> Martin
>>
>>
>> *
>> *   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/
>

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

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