. local array1 "feleclsw finclo fintprtw flabour"
. local array2 "feleclsw_n finclo_n fintprtw_n flabour_n"
. local array3 "feleclsw_d finclo_d fintprtw_d flabour_d"
. local i = 1
. local n: word count `array1'
. while `i' <= `n' {
2. local var1 : word `i' of `array1'
3. local var2 : word `i' of `array2'
4. local var3 : word `i' of `array3'
5. replace `var1' = `var2' / `var3'
6. local i = `i'+1
7. }
feleclsw ambiguous abbreviation
r(111);
Do feleclsw and the other vars in array1 already exist prior to running
this program? If not, then when Stata gets to the -replace-, it thinks you
want to replace either feleclsw_n or feleclsw_d, and since it doesn't know
which one it says you have an ambiguous abbreviation. It seems like you
could do -gen- rather than -replace-; either that, or generate the 4 array1
variables first so they exist and can be replaced.