It's worth explaining the bridge between
this and much shorter solutions given by
others.
The assumption that variable names go
from VAR1-VAR999 can be replaced by
a specification
<whateverisfirstinyourdata>-<whateverislastinyourdata>
and in turn by the wildcard * or _all.
Then you have no need to drop existing macros.
You can do the renaming on the fly:
foreach v of var * {
rename `v' `=lower("`v'")'
}
A small risk with this last trick is that
"all variables" could include temporary variables
with names like __00000A. -rename- that to
__00000a and you will have programming problems.
However, when this is done it is, I guess,
virtually always with the main dataset, and interactively,
so no temporary variables are in sight.
Nick
[email protected]
Rafal Raciborski
> assuming your variables go from VAR1 to VAR999:
>
> macro drop _all
> foreach i of varlist VAR1-VAR999 {
> local j = lower("`i'")
> rename `i' `j'
> macro drop j
> }
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/