word 0
won't work. Stata starts counting at 1
. Change your loop to 1/3
and it will work.
Also, consider tokenize
:
. tokenize `""Growth" "Mature" "All""' . forval i = 1/3 { 2. di "``i''" 3. } Growth Mature All
tokenize
splits a string into tokens, meaning words separated by spaces unless quotation marks bind words together. The tokens have names 1
, 2
, 3
. As you go round the loop, i
is first 1
, so the request is to display the first macro, etc.