Thanks to Kit Baum, an updated version of the elabel commands is now available from the SSC. In Stata, type

Code:
ssc install elabel , replace
to install the latest version.

I have first announced elabel here, where I have also shown some examples. In this post, I will show examples of three new features of elabel.

One of the new features of elabel borrows from a sometimes overlooked syntax element of new variable lists that is used with, e.g., generate:

Code:
generate newvar:lblname =exp
where generate lets you create a new variable and, simultaneously, attach a value label to it. elabel does not create new variables, it defines (or modifies) value labels and now allows you to, simultaneously, attach these value labels to variables using the same (slightly extended) syntax. Here is an example

Code:
. sysuse nlsw88 , clear
(NLSW, 1988 extract)

. describe south-c_city

              storage   display    value
variable name   type    format     label      variable label
------------------------------------------------------------------------------
south           byte    %8.0g                 lives in south
smsa            byte    %9.0g      smsalbl    lives in SMSA
c_city          byte    %8.0g                 lives in central city

. elabel define (south-c_city):yesno 0 "no" 1 "yes"

. describe south-c_city

              storage   display    value
variable name   type    format     label      variable label
------------------------------------------------------------------------------
south           byte    %8.0g      yesno      lives in south
smsa            byte    %9.0g      yesno      lives in SMSA
c_city          byte    %8.0g      yesno      lives in central city

. label list yesno
yesno:
           0 no
           1 yes
In the example above, I have defined one new value label, yesno, and attached it to three variables. To do this, I have put the variable names, followed by a colon, before the value label name; I have used parentheses to refer to more than one variable.

Suppose, I later decide that I want each variable to have its own value label attached. A second feature of elabel borrows from egen's syntax and allows (pseudo-) functions to define (or modify) value labels. I will use a (pseudo-)function to make multiple copies of the value label yesno using the names of the variables that have yesno attached. To get a list of all variables that have a value label yesno attached, I will use ds

Code:
. ds , has(vallabel yesno)
south   smsa    c_city

. local varlist `r(varlist)'

. elabel define `varlist' = copy(yesno)

. label list `varlist'
south:
           0 no
           1 yes
smsa:
           0 no
           1 yes
c_city:
           0 no
           1 yes
In a second step, I will now attach these new value labels to the same-named variables. I will do this using the new extended syntax of elabel values

Code:
. elabel values (`varlist') (`varlist')

. describe south-c_city

              storage   display    value
variable name   type    format     label      variable label
------------------------------------------------------------------------------
south           byte    %8.0g      south      lives in south
smsa            byte    %9.0g      smsa       lives in SMSA
c_city          byte    %8.0g      c_city     lives in central city
I should mention that this example works only for the current label language. Anyway, I hope some of you will find these additions useful.

Best
Daniel