Hi,
I know that the "for" has been abandoned for years but I am still using it when labelling long lists of variables eg:
for any x y \ "this is my first var" "this is my second" : label var X "Y"
To modernize the code I have tried :
local X x y
local Y "this is my first var" "this is my second"
local n : word count `X'
forvalue i=1/`n' {
local a : word `i' of `X'
local b : word `i' of `Y'
label var `a' `b'
}
but my `b' does only include the first word not the label. Is there a way to easily parse the local with the labels?
Thanks
I know that the "for" has been abandoned for years but I am still using it when labelling long lists of variables eg:
for any x y \ "this is my first var" "this is my second" : label var X "Y"
To modernize the code I have tried :
local X x y
local Y "this is my first var" "this is my second"
local n : word count `X'
forvalue i=1/`n' {
local a : word `i' of `X'
local b : word `i' of `Y'
label var `a' `b'
}
but my `b' does only include the first word not the label. Is there a way to easily parse the local with the labels?
Thanks
Comment