Project

General

Profile

Actions

Support #917

open

how to merge xwavedat with data from all the other seven waves

Added by Nico Ochmann almost 7 years ago. Updated over 1 year ago.

Status:
Resolved
Priority:
High
Assignee:
Category:
Data management
Start date:
02/12/2018
% Done:

100%


Description

Dear Alita,

this seems an obvious procedure, but I obtain a fairly high number of non-matches (60,792), which kind of concerns me.
This is what I do and I cannot detect an obvious mistake.
Your suggestions are highly appreciated, as usual.
Best. Nico
use pidp hhorig sex birthy feend_dv ukborn plbornc_all using "$Stata11_se/xwavedat_protect", clear
save $Mergeddata_master2016/xwavedat, replace

foreach w in a b c d e f g {

use  pidp  `w'_istrtdaty `w'_jbhrs `w'_qfhigh_dv  `w'_dvage `w'_marstat  `w'_jbstat   ///    
`w'_paygu_dv `w'_fimnlabgrs_dv `w'_jbsize `w'_jbsect `w'_jbsemp `w'_nnatch ///
`w'_gor_dv `w'_urban_dv `w'_jshrs `w'_jbnssec8_dv ///
using "$Stata11_se/`w'_indresp_protect", clear
gen wave = strpos("abcdefg","`w'")    
renpfix `w'_
save $Mergeddata_master2016/`w'wave, replace
}

use $Mergeddata_master2016/awave, replace
foreach w in b c d e f g{

append using $Mergeddata_master2016/`w'wave.dta
}

save $Mergeddata_master2016/abcdefg_long, replace

merge m:1 pidp using $Mergeddata_master2016/xwavedat, force generate(_wemerge_2)

Result                           # of obs.
-----------------------------------------
not matched 60,792
from master 0 (_wemerge_2==1)
from using 60,792 (_wemerge_2==2)
matched                           334,897  (_wemerge_2==3)
-----------------------------------------
Actions

Also available in: Atom PDF