2013-02-27 87 views
0

我在準備一個表格,它將顯示幾個變量的雙向頻率表。 邏輯是,每個變量都將由相同的二元指標製表。在Stata和esttab中,我如何「對齊」多個雙向表?

我想使用estout系列命令將輸出發送到tex文件。但是,每個交叉製表都出現在新列中。

使用簡單的例子

sysuse auto 
eststo clear 
eststo: estpost tab headroom foreign, notot 
eststo: estpost tab trunk foreign, notot 
esttab, c(b) unstack wide collabels(N) 

給了我一個輸出

---------------------------------------------------------------- 
         (1)      (2)    

       Domestic  Foreign  Domestic  Foreign 
         N   N   N   N 
---------------------------------------------------------------- 
1_missing_5    3   1       
2      10   3       
2_missing_5    4   10       
3      7   6       
3_missing_5   13   2       
4      10   0       
4_missing_5    4   0       
5      1   0   0   1 
6             0   1 
7             3   0 
8             2   3 
9             3   1 
10            3   2 
11            4   4 
12            1   2 
13            4   0 
14            1   3 
15            2   3 
16            10   2 
17            8   0 
18            1   0 
20            6   0 
21            2   0 
22            1   0 
23            1   0 
---------------------------------------------------------------- 
N      74      74    
---------------------------------------------------------------- 

有沒有一種方式,以「對準」輸出,使只有兩列 - - 國內外?

回答

1

如果要輸出到tex文件,一種解決方案是使用esttabappend選項。所以你的情況會是這樣的:

sysuse auto 
eststo clear 
estpost tab headroom foreign, notot 
eststo tab1 
estpost tab trunk foreign, notot 
eststo tab2 
esttab tab1 using outputfile.tex, c(b) unstack wide collabels(N) replace 
esttab tab2 using outputfile.tex, c(b) unstack wide collabels(N) append 

我認爲有可能是一個更優雅的解決方案,以及,但這通常是很容易實現。當您需要指定一些選項來刪除各種列標題時(我相信estout的默認設置假設您不需要大多數這些標題,因此可能需要查看estout而不是esttab )。