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
 Non-normally distributed residuals, advice on how to detrend dataCode for fixed effect regression using Driscoll-Kraay standard errors and residual prediction :
Co… Non-normally distributed residuals, advice on how to detrend dataCode for fixed effect regression using Driscoll-Kraay standard errors and residual prediction :
Co…
 Trivial question: what does f. stand for?Sorry if this is obvious, but I cannot find an answer
As an example
gen treatment=0 if (expectatio… Trivial question: what does f. stand for?Sorry if this is obvious, but I cannot find an answer
As an example
gen treatment=0 if (expectatio…
 Filling in missing values in long dataset using other non-missing valuesHello,
I have a long dataset that includes data on events. Each individual experiences many interva… Filling in missing values in long dataset using other non-missing valuesHello,
I have a long dataset that includes data on events. Each individual experiences many interva…
 generalised structural equation modellingDear all,
I will please like to find out how to include controls in mediation analysis using genera… generalised structural equation modellingDear all,
I will please like to find out how to include controls in mediation analysis using genera…
 Ordered Logit RegressionDear Statalisters,
I have a quick question regarding ordered logits.
I have a panel dataset with i… Ordered Logit RegressionDear Statalisters,
I have a quick question regarding ordered logits.
I have a panel dataset with i…
Subscribe to:
Post Comments (Atom)
0 Response to Merge while keeping value labels in master and using dataset unchanged
Post a Comment