I am trying to do some simple mean summary statistics for each variable with panel data (individual,year), but I fail to get the N(overall obs.) and n (number of clusters/individuals/groups) by ethnic groups (f1, f2, f4, etc.).
The variable native includes all ethnicities plus the native workers. I want to leave out native workers for now, that's why I have the if condition.
This is what I do:
Code:
global summary1 rhw pexpuk pexpabroad edu1_ edu2_ edu3_ edu4_ edu5_ edu6_ edu7_ edu8_ fd_ first_ region7_ region6_ region8_ region2_ bysort native: xtsum $summary1 if f1==1 | f2==1 | f4==1 | f6==1 | f8==1 | f10==1 | f12==1 | f14==1 estpost tabstat $summary1 if f1==1 | f2==1 | f4==1 | f6==1 | f8==1 | f10==1 | f12==1 | f14==1, by(native) stat(mean n N) columns(statistics) esttab . using $graphs_tables/table2_.tex, main(mean %12.1fc) not nostar unstack nomtitle nonumber nonote label replace stats(n N, fmt(%9.0f) labels(Individuals Observations))
ethnicity f1 f2 f4 f6 f8 f10 f12 f14
rhw
pexpuk
.
.
.
.
n
N
When I do:
Code:
ereturn list
I am wondering, which Stata commands to use to obtain the above table structure.
Thanks a lot for your help,
Nico
0 Response to Summary stats with panel data: obtaining both N (overall obs.) and n (group obs.) by ethnic groups
Post a Comment