Dear Statalisters,
This question may seem simple to answer, yet I can't find the solution to my issue. When running this code:
I get the following result:
invalid 'zimbabwe'
r(198);
If I choose to define a global macro rather than a local, I get the following result:
file C:/Users/xxxxx/yyyy/zzzzz/uuuuu/Inputs/survey_1/Zimbabwe/.dta not found
r(601);
Can someone explain me where's the mistake in my code? It shouldn't be hard to spot the error, yet i can't seem to find it.
Please note that there is exactly one file in each of the two Zimbabwe directories. I suspect my problem arised from the fact that the file name has spaces in it, but if my intuition is correct, how to fix this issue without changing the name of the file?
This question may seem simple to answer, yet I can't find the solution to my issue. When running this code:
Code:
forvalues x = 1/2 { local z: dir "$input/survey_`x'/Zimbabwe" files "*.dta" use "$input/survey_`x'/Zimbabwe/`z'", clear rename var1 var2 rename var3 var4 save, replace }
invalid 'zimbabwe'
r(198);
If I choose to define a global macro rather than a local, I get the following result:
file C:/Users/xxxxx/yyyy/zzzzz/uuuuu/Inputs/survey_1/Zimbabwe/.dta not found
r(601);
Can someone explain me where's the mistake in my code? It shouldn't be hard to spot the error, yet i can't seem to find it.
Please note that there is exactly one file in each of the two Zimbabwe directories. I suspect my problem arised from the fact that the file name has spaces in it, but if my intuition is correct, how to fix this issue without changing the name of the file?
Comment