2016-02-02 83 views
0

我在Windows 7上使用Stata 12。我想將賠率比率P>|z|[95% Conf. Interval]輸出值寫入文本文件。我已經嘗試了estoutestab命令,但沒有成功。下面將邏輯迴歸輸出寫入Stata中的文本文件

是理想的命令

use "http://dss.princeton.edu/training/Panel101.dta" , clear 
file open TABLES using "values.txt", write replace //create temporary text 
file write TABLES "the_var ,Odds , P_value, 95%CI" _n // columns headers 
logistic y_bin x1 // run the model 
matrix list e(b) //list the coficients output 
mat values = e(b) //attach the coeficient matrix to a matrix values 
local the_var= "x1" // get the variable name 
local logODD=values[1,1] //get the log odds 

//the problem is extracting these values 
local P_value=P>|z| 
local 95%CI= [95% Conf. Interval] 

file write TABLES "`the_var' , `Odds' , `P_value' , `95%CI'" _n 

但我怎麼能提取出賠率,P_VALUE和95%CI。

+1

'estout'和'esttab'是爲您描述的目的而設計的。也許如果你分享了你的嘗試,有人可以診斷你的問題。 –

+0

我試過使用'e(b)'矩陣結果,但它不包含'P> | z |'和'[95%Conf。間隔]' – Keniajin

回答

0

我認爲esttab varname1 varname2, eform compress應該產生你想要的輸出,但是沒有你的代碼就很難診斷。