help rename tool: Variables Manager
dialog: renpfix
-------------------------------------------------------------------------------
Title
[D] rename -- Rename variable
Syntax
Rename variable
rename old_varname new_varname
Change or remove prefix on variables
renpfix old_stub [new_stub]
Menu
rename
Data > Variables Manager
renpfix
Data > Data utilities > Rename variable
Description
rename changes the name of an existing variable old_varname to
new_varname; the contents of the variable are unchanged.
renpfix changes the prefix old_stub to new_stub for all variable names
that start with old_stub. If new_stub is not specified, the old_stub
prefix is removed.
Examples
---------------------------------------------------------------------------
Setup
. webuse renamexmpl
. describe
Change name of exp to experience and change name of inc to income
. rename exp experience
. rename inc income
Describe the data
. describe
---------------------------------------------------------------------------
Setup
. webuse renamexmpl2, clear
. describe
Change prefix of variables beginning with income to inc
. renpfix income inc
Describe the data
. describe
---------------------------------------------------------------------------
Saved results
renpfix saves the following in r():
Macros
r(varlist) changed variables in dataset
Also see
Manual: [D] rename
Help: [D] generate, [D] varmanage