Dear Experts,
"Wallau" "Bakel" "Weert" "Kempten" "EPLC" are variables.
I have a following code, where i would like to substitute variable CoC with the variable names that are in the loop, if their values contain "X"
Therefore, if variable Bakel has a value "100X" in, lets say row 1, the output of CoC in row 1 should be Bakel.
However in return i get the actual variable values instead of variable names.
Any idea what i did wrong?
Sincerly,
Pavlo
"Wallau" "Bakel" "Weert" "Kempten" "EPLC" are variables.
I have a following code, where i would like to substitute variable CoC with the variable names that are in the loop, if their values contain "X"
HTML Code:
gen CoC = "" foreach i in "Wallau" "Bakel" "Weert" "Kempten" "EPLC" { local x "`i'" replace CoC = `x' if strpos(`i', "X") > 0 }
However in return i get the actual variable values instead of variable names.
Any idea what i did wrong?
Sincerly,
Pavlo
Comment