Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Exporting reg tables with interaction term

    Hello,

    I hope someone can assist me with an issue. I'm using World Values Survey data to explore the correlation between religious affiliation and economic attitudes, I am using interaction terms to examine how the effect differs across various religions.

    I've used the eststo and esttab commands to create tables for my main results. However, when I attempt to apply the same approach to interaction terms, I am struggling to figure out how to correctly use the keep() and drop() options with these variables in "eststo."
    I've attached an example of the table I'm trying to recreate and my regression code. I would really appreciate any guidance on how to handle this and create a similar table with interaction terms.

    Thanks in advance for your help!

    reg trust_people health male age education social_class income atheist roman_catholic##(c.religiosity_index actively_religious currently_religious) protestant##(c.religiosity_index actively_religious currently_religious) jew##(c.religiosity_index actively_religious currently_religious) muslim##(c.religiosity_index actively_religious currently_religious) hindu##(c.religiosity_index actively_religious currently_religious) buddhist##(c.religiosity_index actively_religious currently_religious) orthodox##(c.religiosity_index actively_religious currently_religious) i.S003(country) i.S020(year)

    Regards,
    Ibrahim

    Attached Files

  • #2
    I'm not sure I understand your question. An example using publicly available data would help others help you. Does the following code get you any closer to a solution?

    Code:
    clear
    use https://www.stata-press.com/data/r18/nhanes2l.dta
    
    *estimate and store desired model
    eststo model1: reg  hlthstat age bpsystol sex##race
    
    *list saved results to ID what you want to display in your table
    ereturn list
    matrix list e(b)
    
    *create table of desired coefficients
    estout model1, cells(b se)  keep(age 2.sex 2.sex#2.race)
    Result:
    Code:
    -------------------------
                       model1
                         b/se
    -------------------------
    age              .0237771
                     .0007234
    2.sex            .0698556
                     .0233993
    2.sex#2.race     .1174562
                     .0712604
    -------------------------
    Devra Golbe
    Professor Emerita, Dept. of Economics
    Hunter College, CUNY

    Comment

    Working...
    X