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