title: Select first N words of a local macro in Stata
body: <p>Let's say I have the macro:</p>
  <pre><code>local words = &quot;first second third fourth&quot;
  </code></pre>
  <p>I want to select the first 3 words of it. I know that I can select, say the second, the word using:</p>
  <pre><code>local select: word 2  of `words' 
  di &quot;`select'&quot;
  </code></pre>
  <p>However, I would like to have a line that selects the first <code>N</code> words (in this case <code>N=3</code>) of the said macro. For now, I am using a loop structure that seems quite overkill for such a simple procedure.</p>
  <pre><code>local words = &quot;first second third fourth&quot;
  local select: word 1  of `words' 
  forvalues i=2/3 {
      local rest : word `i' of `words' 
      local select `select'  `rest'
  }
  
  di &quot;`select'&quot;
  first second third
  </code></pre>
  <p>Any better solution? Thank you</p>