Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Forreach loop with esttab
From
Muhammad Ramzan <[email protected]>
To
[email protected]
Subject
Re: st: Forreach loop with esttab
Date
Sun, 12 Jan 2014 20:24:25 +0500
Thanks Roberto Ferrer
How to export results in excel.
I have searched a lot , but unable to find how to export results in
excel with estimates table command.
and how i can have a scalar belowm each cloumd of the table calculated
from coefficient of each equation.
Scalar a= (-1.6500+-0.0066)=-1.66 from equation one.
Similarly from each equation .
like
-----------------------------------------------
Variable | mpg price displa~t
-------------+---------------------------------
foreign | -1.6500 3.6e+03 -25.6127
| -1.5335 5.4399 -2.0061
weight | -0.0066 3.3207 0.0968
| -10.3402 8.3883 12.7984
_cons | 41.6797 -4.9e+03 -87.2355
| 19.2467 -3.6734 -3.3949
-------------+---------------------------------
F | 69.7485 35.3497 152.8503
ll | -1.9e+02 -6.7e+02 -3.8e+02
chi2 |
df_m | 2.0000 2.0000 2.0000
df_r | 71.0000 71.0000 71.0000
a -1.66 3603.32 -25.52
-----------------------------------------------
How this can be done with code.
Regards
MUHAMMAD RAMZAN
On 12 January 2014 19:56, Roberto Ferrer <[email protected]> wrote:
> Several things:
>
> 0. The user-written module ESTOUT, of which -esttab- is part, is
> authored by Ben Jann and available in SSC. Although extremely popular,
> the Statalist FAQ asks you to report where user-written commands come
> from. Type -ssc describe estout- for a descrption.
>
> 1. I prefer
>
> foreach yvar of varlist mpg price displacement {
>
> over
>
> foreach yvar in mpg price displacement {
>
> simply because you are using a variable list, not any list. It doesn't
> affect you here but you might want to read -help foreach-.
>
> 2. I assume your code reads
>
> esttab `yvar'1 using example, t ...
>
> and not
>
> esttab `yvar' using example, t ...
>
> because you would be reporting a different error.
>
> 3. You are using the -replace- option, which does exactly that:
> replace a file previously created. You might want to use -append-,
> instead. This gives you several _stacked_ tables.
>
> 4. If you want side-by-side results, as suggested in -help estimates
> store-, you can try -estimates table- :
>
> clear all
> set more off
>
> sysuse auto
>
> foreach yvar of varlist mpg price displacement {
> regress `yvar' foreign weight
> estimates store `yvar'1
>
> local storelist = "`storelist' `yvar'1"
> }
>
> estimates table `storelist', b(%7.4f) t(%7.4f) stats(F ll chi2 df_m df_r)
>
>
> or get rid of the macro -storelist- and use the system variable _all.
>
> On Sun, Jan 12, 2014 at 5:10 AM, Muhammad Ramzan <[email protected]> wrote:
>> Assalam-o-Alaikum
>>
>> Hi Everyone I am using the foreach lopp command with esttab command.
>> here in the final table i should get results of three equations. but
>> here i am only getting the results of last euquation that is, in which
>> is dependent variable is " displacement ".
>>
>> foreach yvar in mpg price displacement {
>> reg `yvar' foreign weight
>> estimates store `yvar'1
>>
>> esttab `yvar' using example, t scalars(F ll chi2 df_m df_r) nodepvars replace
>>
>> }
>>
>>
>>
>> Regards
>> Muhammad Ramzan
>> *
>> * For searches and help try:
>> * http://www.stata.com/help.cgi?search
>> * http://www.stata.com/support/faqs/resources/statalist-faq/
>> * http://www.ats.ucla.edu/stat/stata/
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/
--
Assalam-o-Alaikum
Muhammad Ramzan
Lecturer (Economics)
Pakistan Institute of Development Economics
Islamabad
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/