Radu Ban
> I want to rename my variables (which now have long names
> since they come
> from an excel sheet). I would like to know if there is a
> quick way to rename
> a recurring word to an abbreviation.
Marcela Perticara
> take a look at renvars
>
> findit renvars
>
> I think it has what you want.
>
It may be of interest to compare with a first
principles solution.
renvars , sub(households hh)
foreach v of var * {
local new : subinstr local v "households" "hh"
if "`new'" != "`v'" {
rename `v' `new'
}
}
-renvars- may look easier, but you have
to find out about it, and find out what
the syntax is. The other solution makes
use of more general tools. Admittedly
the macro function -subinstr- is more a programmer's
tool.
Nick
[email protected]
*
* 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/