So I have a bunch of string variables that cannot be destringed and encode does the job. However, I have many and found this code especially compelling since it uses the names of the other variables so I don't have to do a lot of renaming. However I hit a snag; I get an error from this telling me that it can't locate my first variable in varlist and I can see why; it has put a capitol E in front of it (so if the variable is country it says can't find Ecountry). I can't figure out what the problem is.
foreach v of var varlist {
drop `v'
rename E`v' `v'
}
foreach v of var varlist {
drop `v'
rename E`v' `v'
}