I am trying to export a frequency table generated by tab2 or tabout.

Code:
local var a b c d e f

tab2 `var' treat
Alternatively

Code:
tabout `var' treat using myfile.csv
Is there anyway I could use estout eststo and esttab to produce the table? I assume the code would look like this, but it doesn't work when I run it.

Code:
foreach x in `var'{
    estpost tab `x' treat
    eststo tab`x'
    estout tab`x' using output.doc, c(b) unstack collabels(N) append
}
I am hoping to export this into a table that looks like :
Variable Treat Non-Treat
a freq freq
b freq freq
c freq freq