title: Export average value of one variable over 2 other variables
body: <p>I can use <code>tabout var1 var2...style(csv)</code> to export a matrix-like object with <code>var1</code> on one axis, <code>var2</code> on the other, and the frequencies that each combination of the values <code>var1</code> and <code>var2</code> occur. Is it possible to use <code>tabout</code> 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:</p>
  
  <pre><code>    A    B    C    D
  1
  2
  3
  </code></pre>
  
  <p><code>var2</code> takes on values of <code>1, 2, 3</code> and <code>var1</code> takes on values <code>A, B, C, D</code>. Suppose that there is a third variable, <code>var3</code> that is continuous. Suppose the average value of <code>var3</code> when <code>var1==A</code> and <code>var2==1</code> is <code>3.1</code>. Then this cell would get filled in:</p>
  
  <pre><code>    A    B    C    D
  1  3.1
  2
  3
  </code></pre>
  
  <p>The other values would similarly be filled in. Is there any way to do this in Stata?</p>