Hello!
I am trying to merge two datasets from a survey which contains household ((HH) level data with different variables and thus value labels. First of all, I had to convert these datasets from SPSS to Stata, and then merging them through its common identificator name as, let's say, id. Thus, I used the following command:
use household.dta, clear
merge 1:1 id using using.dta
This succesfully merges the two datasets, but the problem is that the labels of the variables are changed. For example, before merging the datasets, we could have two variables as follows:
HH_A: Categorical variable in master dataset that takes the values of
1 = "X"
2 = "Y"
3 = "Z"
HH_1: Categorical variable in using dataset that takes the values of
1 = "A"
2 = "B"
3 = "C"
When both datasets are merged, HH_1 wrongly takes the value labels of the variable in the master dataset, so that for the values that are equal to 1 the label showed in the merged dataset is X, for 2 "Y" and for 3 "Z", which does not make any sense. How could I fix this? I already tried to reformulate the command so that:
use using.dta, clear
merge 1:1 id using household.dta, nolabel
as nolablel is supposed to order Stata not to copy value-label definitions from using, but this does not work either and the value labels are mixed again but the other way around.
I thank you for the guidance in advance!
Best,
Michelle
Related Posts with Merge while keeping value labels in master and using dataset unchanged
Dependent variable lagsHello How to create a dependent variable lags in the data panel (in stata)? …
Fixed-effect panel threshold modelDear all im working on my PhD thesis and i'm using the fixed-effect threshold model i would ask yo…
Error last estimates not found.Hello I am trying to run a regression among 220 firms from 1998-2018 to predict a yearly beta value.…
Fixed effects dummies in OLS regression vs FE estimator (xtreg, fe)This is a very basic question but after doing some research I could not find the answer to this. I k…
export excelHi STATALIST, The following program runs fine when there is at least on observation in each sheet. …
Subscribe to:
Post Comments (Atom)
0 Response to Merge while keeping value labels in master and using dataset unchanged
Post a Comment