The DHS Program User Forum      
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » STATA codes to merge women and household datasets
STATA codes to merge women and household datasets [message #13937] Fri, 26 January 2018 11:53 Go to next message
Mrinal is currently offline  Mrinal
Messages: 11
Registered: January 2018
Location: Bhubaneswar, India
Member
I am working with NFHS datasets and need to merge women and household datasets using STATA, which I hardly use. May I please have the Stata codes to merge aforementioned datasets of all four rounds of NFHS. I will certainly appreciate it.

Thanks and regards,
Mrinal
Re: STATA codes to merge women and household datasets [message #13957 is a reply to message #13937] Mon, 29 January 2018 20:05 Go to previous messageGo to next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 1456
Registered: February 2013
Senior Member
Following is a response from Senior DHS Stata Specialist, Tom Pullum:

If you want to combine, say, the household (PR) files from the successive surveys, you should use the "append" command. This is distinct from a "merge", in which, say, the KR records and PR records from a single survey could be combined child by child.

Some variables will have different codes and categories in different surveys. For example, v023 may not be defined the same way in every survey. That must be taken into account. When you use the append command, the variable names and labels from the last survey in the append command will over-ride any previous names and labels.

The main reason for appending files is for convenience of file manipulation. In the case of the India surveys, all the files are very large and after appending they will be enormous--and slow to work with. I would recommend trimming the files and just carrying along the variables you need for analysis.

Issues related to appending have been discussed in other forum postings.
Re: STATA codes to merge women and household datasets [message #13961 is a reply to message #13957] Tue, 30 January 2018 03:28 Go to previous messageGo to next message
Mrinal is currently offline  Mrinal
Messages: 11
Registered: January 2018
Location: Bhubaneswar, India
Member
Thank you, Bridgette and Pullum. Actually, I was more interested in merging codes for stata package than appending. However, I managed to construct the merging code for NFHS-2 and is given below.

**Merging household on women dataset**
	**Round 2**
	use "D:\Desktop\dhs\data\nfhs\2\IAHR42FL.DTA", clear
	gen int v001 = hv001
	gen int v002 = hv002
	gen byte v003 = hv003
	sort v001 v002 v003
	save "D:\Dropbox\stata\nfhs\IAHR42FL_sort.DTA", replace
	
	use "D:\Desktop\dhs\data\nfhs\2\IAIR42FL.DTA", clear
	sort v001 v002 v003
	merge v001 v002 v003 using "D:\Dropbox\stata\nfhs\IAHR42FL_sort.DTA"
    
	save "D:\Desktop\dhs\data\nfhs\2\IA_HR_IR_42FL.DTA", replace


Thanks and regards,
Mrinal
Re: STATA codes to merge women and household datasets [message #13996 is a reply to message #13961] Thu, 01 February 2018 11:14 Go to previous messageGo to next message
boyle014 is currently offline  boyle014
Messages: 41
Registered: December 2015
Location: Minneapolis
Member
Mrnal,

You should consider using IPUMS-DHS, which has already harmonized all of the variables across the surveys. You select the samples you want--all of the Indian ones it sounds like--and then the variables you want. You don't have to download separate files and merge or append them. You can download a single file with multiple surveys. The latest Indian sample is being uploaded into the system now. It will be available in March. The other three Indian samples are already there.

Liz Boyle



Professor Elizabeth Boyle
Sociology & Law, University of Minnesota, USA
Principal Investigator, IPUMS-DHS
Re: STATA codes to merge women and household datasets [message #14029 is a reply to message #13996] Mon, 05 February 2018 01:07 Go to previous messageGo to next message
Mrinal is currently offline  Mrinal
Messages: 11
Registered: January 2018
Location: Bhubaneswar, India
Member
Dear Elizabeth,

First of all, I would like to thank and congratulate you and your team for the much needed PUMS-DHS initiative. It is such a relief to have a resource like this when working with huge databases such as NFHS. Interestingly, the first thing I did after getting access to DHS was to browse the IPUMS-DHS project, however, I realized that I should take it as an opportunity to learn a thing or two while preparing the database for analysis. But again I heartily appreciate your contribution in smoothening the path to analyze DHS database.


Mrinal
Re: STATA codes to merge women and household datasets [message #14035 is a reply to message #14029] Mon, 05 February 2018 13:08 Go to previous messageGo to next message
boyle014 is currently offline  boyle014
Messages: 41
Registered: December 2015
Location: Minneapolis
Member
Thanks, Mrinal!

Professor Elizabeth Boyle
Sociology & Law, University of Minnesota, USA
Principal Investigator, IPUMS-DHS
Re: STATA codes to merge women and household datasets [message #14536 is a reply to message #13996] Wed, 18 April 2018 18:52 Go to previous messageGo to next message
Gowokani is currently offline  Gowokani
Messages: 7
Registered: October 2016
Location: Malawi
Member
This IPUMS-DHS , is just unavailable. See the message I am getting (attached)

Gowo

  • Attachment: Capture.PNG
    (Size: 38.31KB, Downloaded 57 times)


Gowokani Chijere Chirwa
Re: STATA codes to merge women and household datasets [message #14542 is a reply to message #14536] Fri, 20 April 2018 14:00 Go to previous message
boyle014 is currently offline  boyle014
Messages: 41
Registered: December 2015
Location: Minneapolis
Member
Dear Gowo,

Sorry to hear that you got a Temporarily Unavailable page. We uploaded lots of new data this week. When we do this, the IT people sometimes have to take the website offline for a minute or two to fix bugs. It's working again now!

Liz Boyle


Professor Elizabeth Boyle
Sociology & Law, University of Minnesota, USA
Principal Investigator, IPUMS-DHS
Previous Topic: merging IR and HIV
Next Topic: merging household and husbands' info to women
Goto Forum:
  


Current Time: Wed Sep 19 09:44:37 Eastern Daylight Time 2018