title: Relabel variables in a loop--invalid syntax?
body: <p>I have a list of variables that I need to relabel. I created paired locals and a loop to rename them like so:</p>
  <pre><code>local demo var1                             ///
  var2                                        ///     
  var3                                        ///
  var4                                        ///
  var5                                        /// 
  var6
  
  local varlabel &quot;label 1&quot;                    ///
  &quot;label 2&quot;                                   ///
  &quot;label 3&quot;                                   ///
  &quot;label 4&quot;                                   /// 
  &quot;label 5&quot;                                   ///
  &quot;label 6&quot;                                       
  
      * Count number of variables in local
      local mydemocount: word count `demo'
      
      
      * Loop through all variables
      forval mycounter = 1/`mydemocount' {
          local myvar:     word `mycounter' of `demo'
          local myvarlabel:        word `mycounter' of `varlabel'
          
          label var `myvar' &quot;`myvarlabel'&quot;
          
      }   
  </code></pre>
  <p>However, I am getting an &quot;invalid syntax&quot; error. Can someone help me identify the problem here? Is there maybe a cleaner way to do this?</p>