Home » Data » Merging data files » STATA codes to merge women and household datasets
Re: STATA codes to merge women and household datasets [message #18063 is a reply to message #18042] |
Tue, 03 September 2019 15:37 |
Bridgette-DHS
Messages: 3229 Registered: February 2013
|
Senior Member |
|
|
Following is a response from DHS Research & Data Analysis Director, Tom Pullum:
Hi Isabelle--Here is how I would do the merge. I use the old version of the merge command but you would get the same thing if you used 1:1. I also introduce a variable called "in_IR", which is coded 1 for every case in the IR file. It just clarifies the "_merge" code, which is described in your results with different terms.
ALL of the 90,303 cases in the IR file are also in the PR file. 427,076 people in the PR file are NOT also in the IR file. Hope this makes sense. Tom
cd e:\DHS\DHS_data\scratch
use "C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata\IAIR42FL.DTA" , clear
gen hv024=v024
gen hv001=v001
gen hv002=v002
gen hvidx=v003
gen in_IR=1
sort hv024 hv001 hv002 hvidx
save IAIR42_temp.dta, replace
use "C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata\IAPR42FL.DTA" , clear
sort hv024 hv001 hv002 hvidx
merge hv024 hv001 hv002 hvidx using IAIR42_temp.dta
replace in_IR=0 if in_IR==.
tab _merge
tab _merge in_IR
The following table is produced:
-
Attachment: table.PNG
(Size: 11.14KB, Downloaded 3969 times)
|
|
|
|
|
STATA codes to merge women and household datasets
By: Mrinal on Fri, 26 January 2018 11:53
|
|
|
Re: STATA codes to merge women and household datasets
|
|
|
Re: STATA codes to merge women and household datasets
By: Mrinal on Tue, 30 January 2018 03:28
|
|
|
Re: STATA codes to merge women and household datasets
By: boyle014 on Thu, 01 February 2018 11:14
|
|
|
Re: STATA codes to merge women and household datasets
By: Mrinal on Mon, 05 February 2018 01:07
|
|
|
Re: STATA codes to merge women and household datasets
By: boyle014 on Mon, 05 February 2018 13:08
|
|
|
Re: STATA codes to merge women and household datasets
By: Gowokani on Wed, 18 April 2018 18:52
|
|
|
Re: STATA codes to merge women and household datasets
By: boyle014 on Fri, 20 April 2018 14:00
|
|
|
Re: STATA codes to merge women and household datasets
By: priyoma on Tue, 23 October 2018 17:18
|
|
|
Re: STATA codes to merge women and household datasets
By: boyle014 on Thu, 01 November 2018 17:20
|
|
|
Re: STATA codes to merge women and household datasets
By: Isabelle on Sun, 11 August 2019 08:48
|
|
|
Re: STATA codes to merge women and household datasets
|
|
|
Re: STATA codes to merge women and household datasets
By: Isabelle on Sat, 24 August 2019 09:56
|
|
|
Re: STATA codes to merge women and household datasets
|
|
|
Re: STATA codes to merge women and household datasets
By: vpatil on Sun, 26 April 2020 00:54
|
Goto Forum:
Current Time: Fri Jan 24 08:03:42 Coordinated Universal Time 2025
|