Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: re: table of long run effects


From   [email protected]
To   [email protected]
Subject   st: re: table of long run effects
Date   Tue, 05 Apr 2005 07:30:17 -0500

Another way is to use -postfile- to create a data set of results and then use -listtex-(use -findit- to locate and download) to create a laTeX, HTML or word processor table.  For example:


sysuse auto ,clear
gen time = _n
tsset time

tempfile results
tempname hold

postfile `hold' str12 var coef std_err t_stat p_value using `results'
qui reg price l.price mpg weight 

foreach var of varlist mpg weight {
	qui nlcom _b[`var']/_b[l.price]
	matrix coef = r(b)
	matrix var =r(V)
	local b = coef[1,1]
	local v = var[1,1]
	local std_err = sqrt(`v')
	local t_stat = `b'/`std_err'
	local p_value = ttail(r(df_r),abs(`t_stat') )*2
	post `hold' ("`var'") (`b') (`std_err') (`t_stat') (`p_value')
}
postclose `hold'
preserve
use `results', clear
li ,  noobs
restore


Hope this helps,
Scott




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