Announcement

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

  • exporting after "mean, over" command

    exporting after "mean, over" command

    hello everyone

    I am having a hard time figuring out how to export my results of the means table as you see here:

    . mean a170, over( time_period name )

    Mean estimation Number of obs = 434,226

    -------------------------------------------------------------------------------------
    | Mean Std. err. [95% conf. interval]
    ------------------------------------+------------------------------------------------
    c.a170@time_period#name |
    1981-1984#United States of America | 7.728843 .0389972 7.65241 7.805276
    1981-1984#Puerto Rico | 0 (no observations)
    1981-1984#Canada | 7.874299 .0468632 7.782449 7.96615
    1981-1984#Haiti | 0 (no observations)
    1981-1984#Dominican Republic | 0 (no observations)
    1981-1984#Trinidad and Tobago | 0 (no observations)
    1981-1984#Mexico | 8.028338 .0393782 7.951158 8.105518


    and the list goes on for thousands of results
    thank you so much for your help

  • #2
    Khair:
    welcome to this forum.
    Why not considering -statsby- (saving a copy of your original dataset before running it)?
    Code:
    use "https://www.stata-press.com/data/r17/nlswork.dta"
     statsby, by( idcode ), if idcode<=1000: mean ln_wage
          Command: mean ln_wage if idcode<=1000
               By: idcode
    
    Statsby groups
    ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
    ..................................................    50
    ..................................................   100
    ..................................................   150
    ..................................................   200
    ..................................................   250
    ..................................................   300
    ..................................................   350
    ..................................................   400
    ..................................................   450
    ..................................................   500
    ..................................................   550
    ..................................................   600
    ..................................................   650
    ..................................................   700
    ..................................................   750
    ..................................................   800
    ..................................................   850
    ...........................................
    
    . list in 1/20
    
         +-------------------+
         | idcode   _b_ln_~e |
         |-------------------|
      1. |      1   2.040433 |
      2. |      2   1.688055 |
      3. |      3   1.584755 |
      4. |      4   1.994632 |
      5. |      5    1.84863 |
         |-------------------|
      6. |      6   1.790184 |
      7. |      7   1.365099 |
      8. |      9   2.063594 |
      9. |     10   1.326461 |
     10. |     12   2.923001 |
         |-------------------|
     11. |     13   2.241816 |
     12. |     14   2.095263 |
     13. |     15    2.48709 |
     14. |     16   2.140758 |
     15. |     17   2.182648 |
         |-------------------|
     16. |     18   1.515292 |
     17. |     19   1.983067 |
     18. |     20   2.086595 |
     19. |     21    1.84121 |
     20. |     22   2.149189 |
         +-------------------+
    
    .
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      that worked perfectly
      thank you so much

      Comment

      Working...
      X