help elabel rename

Title

elabel rename -- Rename value labels

Syntax

Rename single value label

elabel rename
oldlblname
newlblname
[ , options ]

Rename groups of value labels

elabel rename
(oldlbl1 [ oldlbl2 ... ])
(newlbl1 [ newlbl2 ... ])
[ , options ]

elabel rename
oldlblnamelist
[ , {upper|lower|proper} options ]

where oldlblname and oldlbl1, oldlbl2, ... may
contain the wildcard characters *, ?, and #; these
wildcards are explained
below.

newlblname and newlbl1, newlbl2, ... may
contain the wildcard characters *, ?, #,
., and =; these wildcards are explained
below.

The wildcard characters in oldlblname and newlblname have
the following meaning

wildcard means in means in
character oldlblname newlblname

* 0 or more characters copy matched characters
? exactly one character copy matched character
# 1 or more digits copy matched digits
(#[#...]) exactly one[two, ...] copy matched digits and
digit(s) possibly reformat
. skip corresponding
wildcard in oldlblname
= copy oldlblname

Description

elabel rename changes the names of value labels; the
integer-to-text mappings in value labels remain unchanged; new
value label names are attached to all variables that previously
had old value label names attached.

elabel rename follows rules 1-14 described in
rename group (Stata release 12 or higher).

Options

nomemory treats old value label names attached to variables
as if they were defined in memory.

force allows oldlblname to be renamed newlblname
even if newlblname is already attached to variables in the
dataset. newlblname must not be defined in memory.

upper, lower, and proper change value label names
to be all lowercase, all uppercase, or the first letter uppercase and
the remaining letters lowercase.

dryrun does not rename value labels but shows the mapping of
old label names to new label names.

Technical note

If the wildcard character # is specified or if any wildcard characters
are used in newlbl1, newlbl2, ..., the respective wildcard
characters in oldlbl1, oldlbl2, ... are internally matched
using regular expressions. The mapping from wildcards to
regular expressions is as follows

wildcard regular
character expression

* .* if no # follows
[^0-9]* if # follows
? . if no # follows
[^0-9] if # follows
# [0-9]+
(#[#...]) [0-9][[0-9]...]

Examples

Load example dataset

. sysuse nlsw88

Change the value label name occlbl to occup

. elabel rename occlbl occup

Remove the suffix lbl from all value label names

. elabel rename (*lbl) (*)

Change all value label names starting with occ to all uppercase letters

. elabel rename occ* , upper

Author

Daniel Klein

University of Kassel

klein.daniel.81@gmail.com

Also see

Online: label, label language,
rename, rename group

if installed: elabel, labelrename