代码之家  ›  专栏  ›  技术社区  ›  bill999

esttab用逗号和冒号重命名行为

  •  1
  • bill999  · 技术社区  · 7 年前

    假设我有这些数据:

    eststo clear
    sysuse auto2, clear
    

    reg mpg price turn
    

    我想用 esttab rename 重命名变量的功能。但是,当我这样做时:

    esttab, rename("price" "(1,2)" "turn" "(3,5)")
    

    逗号消失了。

    当我这么做的时候:

    esttab, rename("price" "Var1: (1,2)" "turn" "Var2: (3,5)")
    

    我收到一条错误信息。

    重命名

    local a "(1,2)"
    display "`a'"
    esttab, rename("price" "`a'")
    

    但这只是重复了逗号问题。

    如何解决这两个问题(尤其是第一个问题)?

    是一个

    1 回复  |  直到 7 年前
        1
  •  2
  •   user8682794 user8682794    7 年前

    看起来两者都是 , : 用于内部解析,因此如果要使用 rename() 选项。

    eststo clear
    sysuse auto2, clear
    
    label variable price "(1,2)"
    label variable turn "(3,5)"
    
    reg mpg price turn
    esttab, label
    
    ------------------------------------
                                  (1)   
                         Mileage (m~)   
    ------------------------------------
    (1,2)                   -0.000534** 
                              (-3.38)   
    
    (3,5)                      -0.835***
                              (-7.89)   
    
    Constant                    57.69***
                              (14.32)   
    ------------------------------------
    Observations                   74   
    ------------------------------------
    t statistics in parentheses
    * p<0.05, ** p<0.01, *** p<0.001
    

    label variable price "Var1: (1,2)"
    label variable turn "Var2: (3,5)"
    
    reg mpg price turn
    esttab, label
    
    ------------------------------------
                                  (1)   
                         Mileage (m~)   
    ------------------------------------
    Var1: (1,2)             -0.000534** 
                              (-3.38)   
    
    Var2: (3,5)                -0.835***
                              (-7.89)   
    
    Constant                    57.69***
                              (14.32)   
    ------------------------------------
    Observations                   74   
    ------------------------------------
    t statistics in parentheses
    * p<0.05, ** p<0.01, *** p<0.001
    

    编辑:

    的帮助文件 estout 确认:

    rename(matchlist) changes the names of individual coefficients, where
            matchlist is
    
                oldname newname [oldname newname ...]
    
            oldname can be a parameter name (e.g. price) or a full name including
            an equation specification (e.g. mean:price)...
    

    推荐文章