title: Using * to specify variables in Stata loop does not work
body: <p>Why does this code not work in Stata? The error it gives me is that:</p>
  
  <p><code>* invalid name</code></p>
  
  <p>However, when I use </p>
  
  <pre><code>sexd1 sexd2 
  </code></pre>
  
  <p>instead of </p>
  
  <pre><code>sexd*        
  </code></pre>
  
  <p>it works fine. <code>sexd*</code> works fine as a local when I am typing commands in Stata's command box.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>local list_of_variables weight midpoint_hhinc
  tabulate sex, gen(sexd)
  local sexd sexd*
  
  foreach i in `list_of_variables'{
      foreach j in `sexd'{
          generate `i'_`j' = `i' * `j'
      }
  }
  </code></pre>