title: Tabulate categorical variable into dummies with proper labels
body: <p>I have a variable with proper labels:</p>
  
  <pre><code>        Sex |      Freq.     Percent        Cum.
  ------------+-----------------------------------
         Male |  9,043,349       48.70       48.70
       Female |  9,524,274       51.30      100.00
  ------------+-----------------------------------
        Total | 18,567,623      100.00
  </code></pre>
  
  <p>I'd like to create a table with summary statistics by categorical value. It doesn't make a lot of sense here as there is only two values, but let's do it anyways. I generate</p>
  
  <pre><code> tab sex, gen(sexd_)
  </code></pre>
  
  <p>and then when I create the table:</p>
  
  <pre><code>. esttab test, replace cell("mean")  label
  
  ---------------------------------
                                (1)
  
                               mean
  ---------------------------------
  sex==Male                .9028908
  sex==Female              .0971092
  ---------------------------------
  Observations               123943
  ---------------------------------
  </code></pre>
  
  <p>But the table shows the silly <code>sex==</code> prefix, I'd like to only have <code>Male</code> and <code>Female</code> here. This is because <code>tab, generate</code> creates the variables like that:</p>
  
  <pre><code>                              (1)
  
                               mean
  ---------------------------------
  sex==Male                .9028908
  sex==Female              .0971092
  ---------------------------------
  Observations               123943
  ---------------------------------
  </code></pre>
  
  <p>How can I neatly create the labels I want, without manually going through all entries?</p>