Announcement

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

  • Flipping rows and columns in a Table generated with esttab

    Dear Stata Forum,
    I have the following question.
    I would like to flip rows and columns in a table generated by esttab.
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float(un changeoccup comb)
    0   0  7
    0   0  8
    0   0  3
    0 100  2
    0 100  9
    0   0  3
    0   0  3
    0   0 10
    0   0  3
    0   0 10
    0   0  1
    0   0 10
    0   0  4
    0   0  8
    0 100 10
    0   0  8
    0   0  3
    0   0  3
    0 100  9
    0   0  8
    0 100  4
    0   0  3
    0   0  4
    0   0  7
    0   0 10
    0   0  2
    0   0  7
    0   0  7
    0 100  8
    0   0 10
    0   0  3
    0 100  7
    0   0  1
    0 100  8
    0   0  7
    0 100  4
    0   0 10
    0 100  9
    0   0  8
    0   0  5
    0   0  8
    0   0  7
    0   0  1
    0   0  9
    0 100  9
    0   0  7
    0   0  4
    0   0  3
    0   0  3
    0 100  1
    0   0  1
    0 100 10
    0   0  7
    0   0  3
    0   0  1
    0 100  3
    0   0  5
    0   0  4
    0 100  7
    0   0  3
    0   0  7
    0   0  8
    0   0  4
    0   0 10
    0   0  1
    0   0  8
    0   0 10
    0 100  4
    0   0  7
    0 100 10
    0   0  5
    0   0  7
    0   0  9
    0   0  9
    0   0  7
    0   0  9
    0   0  1
    0   0  3
    0   0  7
    0   0 10
    0 100  2
    0   0  4
    0 100  5
    0   0  3
    0 100 10
    0   0  7
    0   0 10
    0   0  1
    0   0  4
    0   0  4
    0 100  7
    0   0  3
    0 100  8
    0   0  7
    0   0  1
    0   0  3
    0   0  5
    0   0  1
    0   0  3
    0   0  1
    end
    label values comb comb
    label def comb 1 "Bangladeshi, Muslim", modify
    label def comb 2 "Bangladeshi, Other religion", modify
    label def comb 3 "Chinese, No religion", modify
    label def comb 4 "Chinese, Christian", modify
    label def comb 5 "Chinese, Buddhist", modify
    label def comb 7 "Indian, Hindu", modify
    label def comb 8 "Indian, Muslim", modify
    label def comb 9 "Indian, Sikh", modify
    label def comb 10 "Indian, Other religion", modify
    Code:
        
    eststo A: estpost sum un changeoccup  if comb==1 
    eststo B: estpost sum un changeoccup  if comb==2 
    eststo C: estpost sum un changeoccup if comb==3 
    esttab A B C using $output\tables/descriptivestatistics_fe.tex, replace obs main(mean 1) nostar  nonote label nonumber nogap onecell compress
    I would like to have `comb' as rows (since I have a large number of them) and `un' and `changeoccup' as columns.
    How would I need to modify my `esttab' line to flip rows and columns.
    Thanks,
    Nico
Working...
X