title: Stata: Transposing panel rows to column
body: <p>I am trying to rearrange the following panel data set into a form where I can merge with another. I would like to transform this:</p>
  
  <pre><code>Gender  Year  IndA  IndB  IndC
     1    2008  0.22  0.34  0.45
     2    2008  0.78  0.66  0.55
     1    2009  0.25  0.36  0.49
     2    2009  0.75  0.64  0.51
     1    2010  0.28  0.38  0.48
     2    2010  0.72  0.62  0.52
  </code></pre>
  
  <p>Into:</p>
  
  <pre><code>(ID)  Year  Industry    1    2
    1   2008     A      0.22  0.78
    2   2009     A      0.25  0.75
    3   2010     A      0.28  0.72 
    4   2008     B      0.34  0.66
    5   2009     B      0.36  0.64
    6   2010     B      0.38  0.62
    7   2008     C      0.45  0.55
    8   2009     C      0.49  0.51
    9   2010     C      0.38  0.62
  </code></pre>
  
  <p>I am new to Stata and am having difficulties reshaping both the columns and the genders. </p>