Starting from where you are now,
foreach v of var iso_* {
local newname "`: var label `v''"
local newname : subinstr local newname "iso==" ""
rename `v' `newname'
}
Starting from your original -iso_str-:
levelsof iso_str, local(levels)
foreach l of local levels {
gen byte `l' = iso_str == "`l'"
}
However, this example really hinges on the fact that
your string values happen all to be legal variable names.
Nick
[email protected]
In trying out solutions just provided I did run into what you said
here. I had a string with "." as the content. I had to replace that
with "" for the levels of solution to work, which it did! Thank you!
I also see that the last time I used levels it was levels rather than
the new Stata 9 (probably 10) levelsof.