Bookmark and Share

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]

st: AW: Exporting ivreg2 results in a simple long table


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: Exporting ivreg2 results in a simple long table
Date   Thu, 20 May 2010 16:13:15 +0200

<> 

You could also try a -postfile- approach, as in Michael`s
http://www.michaelnormanmitchell.com/stow/posting-results-regression.html.
It makes the customization step considerably more straightforward in my
opinion.


*************
sysuse auto, clear

tempname hdle
capt erase info.dta

postfile `hdle' str15 coef estim /* 
*/ se foreign using info

qui levelsof foreign

qui foreach lev in `r(levels)'{
		ivreg2 price mpg (headroom = trunk) if foreign==`lev',
ffirst
		post `hdle' ("mpg") (_b[mpg]) (_se[mpg]) (`lev')
		post `hdle' ("headroom") (_b[headroom]) (_se[headroom])
(`lev')
}

postclose `hdle'

u info, clear
format estim se %9.2fc
l, noobs sepby(foreign)

//save as .dta
save mydtaresults, replace

//save as .txt
outsheet using "C:\Users\martin\Documents\Stata\mytxtresults.txt", replace
!start mytxtresults.txt

*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Chuck Cleland
Gesendet: Donnerstag, 20. Mai 2010 15:33
An: [email protected]
Betreff: st: Exporting ivreg2 results in a simple long table

Dear All,

  I am using ivreg2 in combination with a "by" prefix command as follows:

by imp: ivreg2 mydv mycov (endotx = myinstru) , ffirst

  This works fine, but I would like to save the resulting coefficients
and standard errors in a simple, long table.  Something like the following:

coef   estim    se imp
----------------------
mycov   1.11  0.40   1
endotx  3.11  0.49   1
mycov   1.07  0.51   2
endotx  3.02  0.63   2
mycov   1.61  0.38   3
endotx  3.18  0.56   3
..
endotx  2.83  0.44  10

  Then I would like to export the table to a *.dta or plain text file.
What is the best way to go about this?

Thanks,

Chuck Cleland

-- 
Chuck Cleland, Ph.D.
NDRI, Inc. (www.ndri.org)
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/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/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index