Announcement

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

  • exporting results using estadd

    Hi everyone,
    I am using Italian time use data. I report a fake example of my dataset:
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str6 individual double(play sport)
    "1"  10 20
    "2"  0   30
    "3"  40   0
    "4"  0  50
    "5"  0  60
    "6"  20   0
    "7"  0 210
    "8"  70 340
    "9"  0 110
    "10"  20  90
    
    end
    where "individual" is individual j's identifier and play and sport represents the amount of time spent playing/doing sports! Since I want to compute the Gini index and the ratio between the 90th and 10th percentile of the distribution I am using ineqdec0!
    I would like to know how can I export ineqdec0 results.....I tried to use estadd+estout but I think I made some mistakes since STATA tells me that there is no previous estimation result found. The loop I used is the following:
    Code:
    foreach X of varlist play sport{
    ineqdec0 `X'
    return list
    local gini_`X'=r(gini)
    local p90p10_`X'=r(p90p10)
    estadd local Model_`X' gini_`X' p90p10_X'
    estout Model_`X' using table1.txt, append style(fixed)
    }
    Is anyone able to help me?
    Thank you in advance

  • #2
    There were some typos, and (I think) some misunderstanding of estadd syntax. Try this:

    Code:
    foreach X of varlist play sport{
    ineqdec0 `X'
    return list
    * local gini_`X' = r(gini)
    * local p90p10_`X' = r(p90p10)
    estadd scalar r(gini) , prefix(Model_`X'_)
    estadd scalar r(p90p10) , prefix(Model_`X'_)
    * estadd local Model_`X' gini_`X' p90p10_`X'
    ereturn list
    * estout Model_`X' using table1.txt, append style(fixed)
    
    }
    It produces results in e(). Over to you with estout from there

    Comment


    • #3
      Thank you! I was sure I was doing wrong something, it was the first time I was using estadd

      Comment

      Working...
      X