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
Importing fixed width data using infix - dictionary invalidHello, I am importing fixed with data from a .txt file. Here is my code: Code: cd "...\1973-09-t…
Graphing interactions with margins after melogit with random interceptsI have an interaction term between season and temperature in my final model (both 4-level categorica…
Calculate Exponentially Weighted Moving Average for Unbalanced Panel DataHi all, I want to calculate exponentially weighted moving average of past performance in an unbalan…
"Hessian has become unstable or asymmetric" error in Panel ARDL modelDear All, I try to run panel ARDL model to apply these variables: inflation, capacity utilisation, c…
common supporthi how can i use the value of pscore to construct the common support. i should use the minimum betwe…
Subscribe to:
Post Comments (Atom)
0 Response to Merge while keeping value labels in master and using dataset unchanged
Post a Comment