Hi there,

I am trying to do something like this:

Code:
local group1 var1 var2 var3
local group2 var4 var5 var6
local group3 var7 var8 var9

foreach v in `group1' `group2' `group3' {
   sum `v' if year==1
   sum `v' if year==2
}
This is just for summary statistics, in which I calculate means for two years separately.

I, however, would like to export the stats in a .csv file using eststo/esttab command. I went for something like this:

Code:
local group1 var1 var2 var3
local group2 var4 var5 var6
local group3 var7 var8 var9

foreach v in `group1' `group2' `group3' {
   eststo: sum `v' if year==1
   esttab using "table.csv", stats(mean sd) title("Summary Statistics") replace
}
Previously, I have used eststo/esttab only to storing regression coefficients/stats, and not to store summary stats.

I'd really appreciate your help on this.

Thanks a lot!