Dear all,
maybe this question will make smile several of you, but now I am facing some difficulties to resolve it.
I got a matrix with data (580+k) on three variables (2 string, 1 double) and I am trying to reshape it wide from long. Stata do not accept that the j(var) have names with spaces, but I am obliged to use that.
As in the do file I have also a variable (str5 "Code") that would allow to resolve this problem because it is uniquely linked to one (origin) of the two string variables that I need to use to perform the reshape, I am trying to replicate the variable (str5) to the second string variable (destination), but I need to respect the unique linkage with the new variable.

I am trying to perform a trivial foreach loop, but I cannot arrive to find the good sintax.
Hope someone could help me to find a plausible solution to that. Thanks.
maybe this question will make smile several of you, but now I am facing some difficulties to resolve it.
I got a matrix with data (580+k) on three variables (2 string, 1 double) and I am trying to reshape it wide from long. Stata do not accept that the j(var) have names with spaces, but I am obliged to use that.
As in the do file I have also a variable (str5 "Code") that would allow to resolve this problem because it is uniquely linked to one (origin) of the two string variables that I need to use to perform the reshape, I am trying to replicate the variable (str5) to the second string variable (destination), but I need to respect the unique linkage with the new variable.
I am trying to perform a trivial foreach loop, but I cannot arrive to find the good sintax.
Code:
gen code_dest= Code foreach i in origin { replace code_dest=... if ... }
Comment