The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » How to merge a person-level data with a child-level data
How to merge a person-level data with a child-level data [message #20008] Tue, 15 September 2020 02:28 Go to next message
ojh798 is currently offline  ojh798
Messages: 2
Registered: September 2020
Member
Dear DHS data expert,

I have one question regarding merging dataset A (a person-level data used as a base file) with dataset B (a child-level data used as a secondary file).

Dataset A (a base file or master file): It was reshaped from wide to long based on a list of variables from hvidx_01 to hvidx_21 from a household-level data. In this reshaped data, a new variable called "pnum" (unique person number from 1 to 21 within each household) was created. As linking variables, there are hhid (12-digit number=hv001+hv002) and hv003 (respondent's line number: 3-digit number).

Dataset B (a secondary file or using file): It is a child-level data. As linking variables, there are hwcaseid (15-digit number = hv001+hv002+hv003) and hwline (values = 1, 2, 3).

In order to merge a person-level data (person numbers within each household range from 1 to 21) with a child-level data (child numbers within each household range from 1 to 3), how can I do? The point I would like to consult with you is to ensure which person number in the base data file can correspond to which child number in the secondary data file. Could you help me to resolve with this data merging issue?

Thank you so much in advance.

Best,
Jihyun
Re: How to merge a person-level data with a child-level data [message #20011 is a reply to message #20008] Tue, 15 September 2020 07:53 Go to previous messageGo to next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 1919
Registered: February 2013
Senior Member

Following is a response from DHS Research & Data Analysis Director, Tom Pullum:

Is your "dataset A" the HR file? If so, it will be much easier if you use the PR file, which is already equivalent to a reshaped (long) HR file. You can then just merge the PR and BR files. In the BR file, the line number of the child is b16. This corresponds to hvidx in the PR file.

If you reshaped (long) the HR file, which as I said is not necessary, the person-level index you are asking about would be hvidx.

The BR file contains children of all ages as well as children who have died. Therefore when you do a PR/BR merge there will be many BR cases that are not in the PR file.

Re: How to merge a person-level data with a child-level data [message #20014 is a reply to message #20011] Tue, 15 September 2020 15:13 Go to previous message
ojh798 is currently offline  ojh798
Messages: 2
Registered: September 2020
Member
Dear Bridgette,

Thank you so much for your prompt reply. It's very helpful to me. Thank you for your consideration.

Best,
Jihyun
Previous Topic: Merging IR and PR 2016 UDHS
Goto Forum:
  


Current Time: Wed Sep 23 17:52:31 Eastern Daylight Time 2020