title: How do I create a transition matrix in Stata (and export it to Excel)?
body: <p>I have data that looks something like this (in Stata):</p>
  
  <pre><code>  ID: Cat_period_1:  Cat_period_2:
    1      cat3          cat15
    2      cat35         cat35
    3      cat5          cat6
    ...    ...           ...
    N       N            N
  </code></pre>
  
  <p>I want to create a matrix (and if possible export it into Excel) of transition counts/fractions (i.e. of transitions between <code>Cat_period_1</code> and <code>Cat_period_2</code>). Any suggestion on how I can do this?</p>
  
  <p>Note: 
  I tried to simply do a: <code>tab Cat_period_1 Cat_period_2</code>
  but doing this returns an error message because the matrix that I want to create is too big for the <code>tab</code> command.  </p>