sum HH1 HH2 LN // HH1=cluster number, HH2=household number, LN=line number (child in household)
gen idnumber = string(HH1) + " " + string(HH2) + " " + string(LN)
gen id = string(HH1) + " " + string(HH2) // use this to merge with hh data below
save ch.dta, replace // this will save to current working directory
use "/Users/justinegosling/Desktop/Malawi_MICS5_Datasets/Malawi MICS 2013-14 SPSS Datasets/House hold.dta"
// 28479 observations, 177 variables
// this also has the same HH1 HH2 variables:
sum HH1 HH2
gen id = string(HH1) + " " + string(HH2) // to merge on household id with child data
merge 1:m id using "/Users/justinegosling/Desktop/Malawi_MICS5_Datasets/Malawi MICS 2013-14 SPSS Datasets/childrens .dta"
Can someone please tell me why after the above coding when I try to merge the data states response is: variable id not found r(111);
Many thanks
Related Posts with Can someone tell me why the variable 'id' can't be found please?
Conflicting results - xtsktest and jb -Hello everyone, I apologize in advance in case this is a silly questions but I could not find enligh…
ICD10 with multiple variablesHi, I am relatively new to Stata so apologies if this is a basic question but I hope someone can he…
Unifying country names when merging dataI have data from different sources, some use names for a country and other sources use different nam…
Is it possible to combine twoway binscatter?Is it possible to superimpose binscatter plot? I would usually do this with scatter in the followin…
Logistic regression diagnosticsHey everyone, I am currently running a logistic regression with several independent variables. As …
Subscribe to:
Post Comments (Atom)
0 Response to Can someone tell me why the variable 'id' can't be found please?
Post a Comment