I want to describe characteristics of cars by origin, and retrieve the result as latex table:
sysuse auto
estpost tabstat price trunk, by(foreign) statistics(mean sd) columns(statistics) listwise nototal
esttab using test.txt, main(mean) aux(sd)
Already after the estpost I can feel that the labels are going missing: it correctly displays the value labels "Domestic" and "Foreign", but simply lists the variables as "price" and "trunk" instead of "Price" and "Trunk space".
I have seen this problem on the internet, but no solution is satisfactory. Some suggest fsum, but that doesn't really allow latex, and also no cross-tabulation (means of x by category y).
How can I fix this?
I automatized the accepted's answer as follows:
local varlabels
foreach var in price trunk {
local varlabels `"`varlabels' `var' "`:variable label `var''""'
}