title: Using esttab with ttest
body: <p>I am running a <code>ttest</code> command and exporting results to LaTeX using <code>estpost</code> and the <em>community-contributed</em> command <code>esttab</code>. </p>
  
  <p>I am testing for a difference for means (of variable <code>height</code>, by <code>child gender</code>) for several years and would like the years to be displayed <em>vertically</em> (in rows) rather than horizontally. </p>
  
  <p>My code and is given below:</p>
  
  <pre><code>foreach i in 2009 2010 2013 {
      use "`i'.dta", clear
      global year `i'
      eststo _$year : estpost ttest height, by(child_gender)
  }
  
  esttab . using "trends.tex", nonumber append
  </code></pre>
  
  <p>Data for 2009:</p>
  
  <pre><code>* Example generated by -dataex-. To install: ssc install dataex
  clear
  input float(child_gender height)
  0 156
  1 135
  0 189
  1 168
  0 157
  1 189
  1 135
  1 145
  0 124
  1 139
  end
  </code></pre>
  
  <p>Data for 2010:</p>
  
  <pre><code>* Example generated by -dataex-. To install: ssc install dataex
  clear
  input float(child_gender height)
  0 151
  1 162
  0 157
  1 134
  0 157
  1 189
  1 135
  1 145
  0 143
  1 166
  end
  </code></pre>
  
  <p>Data for 2013:</p>
  
  <pre><code>* Example generated by -dataex-. To install: ssc install dataex
  clear
  input float(child_gender height)
  0 177
  0 135
  0 189
  0 168
  0 157
  1 189
  1 135
  1 145
  1 124
  1 127
  end
  </code></pre>
  
  <p>I would like the output arranged as follows (but in <code>LaTeX</code>):</p>
  
  <p><a href="https://i.stack.imgur.com/USpIt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/USpIt.png" alt="enter image description here"></a>    </p>
  
  <p>Any suggestions on how to make this work? </p>