Project

General

Profile

Support #1769 » link.do

Shujun Liu, 09/13/2022 11:47 AM

 

**open the household level file
use j_hidp j_hhsize j_xphsdb j_xphsdct j_xphsdba j_hhpc1 j_hhpc2 j_hhpc3 j_hhpc4 j_hhpc5 j_hhpc96 j_pcnet j_nemp_dv j_hhtype_dv j_fihhmngrs_dv j_fihhmngrs_if using j_hhresp_ip, clear

**sort it on the household identifier, w_hidp
sort j_hidp

**save this temporary file
save hhinfo, replace

**open the individual-level file
use pidp j_hidp j_pno j_jbstat j_twithave j_scbrowsesp j_scemailsp j_scphotosp j_scsmlooksp j_scsmpostsp j_scbuysp j_scbanksp j_scinstalsp j_scgpssp j_scblutthsp j_scgamessp j_scstreamsp j_scothersp j_scbrowsetb j_scemailtb j_scphototb j_scsmlooktb j_scsmposttb j_scbuytb j_scbanktb j_scinstaltb j_scgpstb j_scblutthtb j_scgamestb j_scstreamtb j_scothertb j_scskillsp j_scskilltb j_sex j_dvage j_marstat j_employ j_agegr10_dv j_qfhigh_dv j_jbseg_dv j_hhorig j_psu j_strata j_indpxip_xw j_indinip_xw j_indscip_xw j_fimngrs_dv using j_indresp_ip, clear

**sort it on the household identifier,
sort j_hidp

**merge it with the earlier save file on j_hidp. The output shows how many cases matched
merge m:1 j_hidp using hhinfo

**drop the variable (essential)
drop _merge
save linked_data, replace

erase hhinfo.dta

*******************************************************************************

(3-3/3)