Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Re: easier way to rename?

From   "Nick Cox" <>
To   <>
Subject   st: RE: Re: easier way to rename?
Date   Sun, 15 Sep 2002 18:04:48 +0100

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 

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index