Format 使用esttab设置表格格式

Format 使用esttab设置表格格式,format,stata,tabular,Format,Stata,Tabular,我能够创建我想要的大部分内容:在同一个表中并排创建两个单向表格(报告累积百分比)。这很好,但是我需要一些格式化方面的帮助。玩具示例: sysuse auto, clear eststo clear eststo a: estpost tabulate rep78 if foreign==0 eststo b: estpost tabulate rep78 if foreign==1 esttab, cells("cumpct(fmt(2))") /// varlabels("a" "b"

我能够创建我想要的大部分内容:在同一个表中并排创建两个单向表格(报告累积百分比)。这很好,但是我需要一些格式化方面的帮助。玩具示例:

sysuse auto, clear
eststo clear
eststo a: estpost tabulate rep78 if foreign==0
eststo b: estpost tabulate rep78 if foreign==1
esttab, cells("cumpct(fmt(2))") ///
    varlabels("a" "b")      ///
    nonumber nomtitle noobs ///
    collabels("a" "b")
这将产生以下结果:

--------------------------------------
                        a            a
--------------------------------------
1                    4.17             
2                   20.83             
3                   77.08        14.29
4                   95.83        57.14
5                  100.00       100.00
Total                                 
--------------------------------------
我怎样才能:

  • 除去总行和
  • 使列标签具有不同的名称?我想将第二列命名为
    b
    ,而不是
    a
    。我在collabels中使用了不同的内容变体(
    AB
    “AB”
    “a”“b”
    ),但似乎没有任何效果

  • 其中任何一个都可以做到:

    sysuse auto, clear
    eststo clear
    qui eststo a: estpost tabulate rep78 if foreign==0
    qui eststo b: estpost tabulate rep78 if foreign==1
    esttab, cells("cumpct(fmt(2))") ///
        nonumber mtitles("a" "b") nodepvars noobs drop(Total) collabels(none)
    
    eststo clear
    qui eststo a, title("a"): estpost tabulate rep78 if foreign==0
    qui eststo b, title("b"): estpost tabulate rep78 if foreign==1
    esttab, cells("cumpct(fmt(2))") ///
        nonumber mtitles nodepvars noobs drop(Total) collabels(none)
    
    我更喜欢第二种语法,因为我喜欢在估计模型的位置附近命名模型

    两者都会产生类似于:

    --------------------------------------
                            a            b
    --------------------------------------
    1                    4.17             
    2                   20.83             
    3                   77.08        14.29
    4                   95.83        57.14
    5                  100.00       100.00
    --------------------------------------
    

    其中任何一个都可以做到:

    sysuse auto, clear
    eststo clear
    qui eststo a: estpost tabulate rep78 if foreign==0
    qui eststo b: estpost tabulate rep78 if foreign==1
    esttab, cells("cumpct(fmt(2))") ///
        nonumber mtitles("a" "b") nodepvars noobs drop(Total) collabels(none)
    
    eststo clear
    qui eststo a, title("a"): estpost tabulate rep78 if foreign==0
    qui eststo b, title("b"): estpost tabulate rep78 if foreign==1
    esttab, cells("cumpct(fmt(2))") ///
        nonumber mtitles nodepvars noobs drop(Total) collabels(none)
    
    我更喜欢第二种语法,因为我喜欢在估计模型的位置附近命名模型

    两者都会产生类似于:

    --------------------------------------
                            a            b
    --------------------------------------
    1                    4.17             
    2                   20.83             
    3                   77.08        14.29
    4                   95.83        57.14
    5                  100.00       100.00
    --------------------------------------
    

    是否有类似于
    eqlabels(,lhs(“修复记录”)
    ?我想在1,…5列上面写些东西。@bill999 Try
    esttab,cells(“cumpct(fmt(2))).mlabels(,lhs(“修复记录”))varwidth(15)collabels(none)nonumber nodepvars noobs noobs noobs drop(Total)noubs noubs noubs noubs noubs low(Total)noubs noubs noubs noubs noubs noubs noubs。谢谢不过,这似乎去掉了标题标签(我认为“a”和“b”显示为列标签的原因是eststo估算被命名为“a”和“b”)。还有什么东西可以两全其美吗?@bill999上面我错了,所以让我澄清一下。按照我现在的理解,mlabel()是一个
    estout
    选项,而mtitle()是一个
    esttab
    选项
    esttab
    只是
    estout
    的包装,语法更为有限但更为简化,
    estout
    选项在确认时优先于
    esttab
    选项。lhs()仅适用于mlabels()、eqlabels()和collabels()。但是你可以得到一个维修记录类型标签,标题来自
    eststo
    ,带有
    mlabels(,lhs(“维修记录”))varwidth(15)mtitles
    ,因为在这种情况下,它们不会产生干扰。是否有类似于
    eqlabels(,lhs(“维修记录”)
    ?我想在1,…5列上面写些东西。@bill999 Try
    esttab,cells(“cumpct(fmt(2))).mlabels(,lhs(“修复记录”))varwidth(15)collabels(none)nonumber nodepvars noobs noobs noobs drop(Total)noubs noubs noubs noubs noubs low(Total)noubs noubs noubs noubs noubs noubs noubs。谢谢不过,这似乎去掉了标题标签(我认为“a”和“b”显示为列标签的原因是eststo估算被命名为“a”和“b”)。还有什么东西可以两全其美吗?@bill999上面我错了,所以让我澄清一下。按照我现在的理解,mlabel()是一个
    estout
    选项,而mtitle()是一个
    esttab
    选项
    esttab
    只是
    estout
    的包装,语法更为有限但更为简化,
    estout
    选项在确认时优先于
    esttab
    选项。lhs()仅适用于mlabels()、eqlabels()和collabels()。但是您可以使用
    eststo
    mlabels(,lhs(“修复记录”))varwidth(15)mtitles
    获得修复记录类型标签,因为在这种情况下,它们不会产生干扰。