Hi,
I want to merge two data sets (household-level data and individual-level data) and some of the value labels are not unique between the two datasets (e.g., label labels1 already defined). If not modified, they get overwritten when merging.
I tried to use the community-contributed command elabel before merging to rename the labels, but the command does not complete execution. It gets stuck and nothing happens even after a long wait (because the data set is relatively large, I also tried keeping only two variables and value labels, but had no luck).
My version of elabel, downloaded from github is:
*! version 4.4.2 28dec2021 daniel klein
***Individual-level data
use person, clear
***elabel command
elabel rename (*) (*_person)
***merging person and hh data sets (if this step is done without modifying the labels, the labels get overwritten and some household variables get value labels from the individual-level data)
merge m:1 serial using hh
Anyone knows why elabel might not be working, or have suggestions for me to try?
I did install a previous version of elabel from ssc, and then uninstalled it and installed the one from GitHub after reading this post.
As a workaround, this code worked in this case (where the labels are named from 0 to 780)
forval i = 0/780 {
label copy labels`i' labels`i'_person
findname, vallabelname(labels`i') local(myvars)
foreach var of local myvars {
label values `var' labels`i'_person
}
label drop labels`i'
}
Thanks for any leads!
I want to merge two data sets (household-level data and individual-level data) and some of the value labels are not unique between the two datasets (e.g., label labels1 already defined). If not modified, they get overwritten when merging.
I tried to use the community-contributed command elabel before merging to rename the labels, but the command does not complete execution. It gets stuck and nothing happens even after a long wait (because the data set is relatively large, I also tried keeping only two variables and value labels, but had no luck).
My version of elabel, downloaded from github is:
*! version 4.4.2 28dec2021 daniel klein
***Individual-level data
use person, clear
***elabel command
elabel rename (*) (*_person)
***merging person and hh data sets (if this step is done without modifying the labels, the labels get overwritten and some household variables get value labels from the individual-level data)
merge m:1 serial using hh
Anyone knows why elabel might not be working, or have suggestions for me to try?
I did install a previous version of elabel from ssc, and then uninstalled it and installed the one from GitHub after reading this post.
As a workaround, this code worked in this case (where the labels are named from 0 to 780)
forval i = 0/780 {
label copy labels`i' labels`i'_person
findname, vallabelname(labels`i') local(myvars)
foreach var of local myvars {
label values `var' labels`i'_person
}
label drop labels`i'
}
Thanks for any leads!
Comment