I can use tabout var1 var2...style(csv) to export a matrix-like object with var1 on one axis, var2 on the other, and the frequencies that each combination of the values var1 and var2 occur. Is it possible to use tabout or some other commmand (preferably native to Stata) to do something similar except instead of the frequencies filling the cells, the average value of a third variable would. For example, suppose the skeleton of this structure is as follows:
A B C D
1
2
3
var2 takes on values of 1, 2, 3 and var1 takes on values A, B, C, D. Suppose that there is a third variable, var3 that is continuous. Suppose the average value of var3 when var1==A and var2==1 is 3.1. Then this cell would get filled in:
A B C D
1 3.1
2
3
The other values would similarly be filled in. Is there any way to do this in Stata?
You can use
table'scontents()option:Something similar can be achieved with
tabout(from SSC):