The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » Merging 2018 Zambia HR to IR (Need help merging 2018 Zambia HR to IR)
Merging 2018 Zambia HR to IR [message #26011] Thu, 26 January 2023 22:46 Go to previous message
azimkl10 is currently offline  azimkl10
Messages: 3
Registered: January 2023
Member
Hi everyone,

I need help with merging 2018 Zambia HR to IR and I am running into many issues.

First, my objective is to get each child between ages 5-18 as a row/observation for data analysis and variables of interest are in the household and individual dataset. I have tried merging household data to individual data by joining v001 and v002 and hv001 and hv002 but that did not work. One issue I have is that each mother is the row/observation and each child is represented in the columns meaning that when asked about the mother's children, each child is a different column of the same question. For example, HV122: Education level attended during the current school year (Primary, Secondary, etc.) is my outcome variable and it goes from hv122_01 to hv122_28. This means that there is a mother(s) who has had up to 28 children and each of the children is represented in a column instead of a row. I tried to pivot_longer the columns of interest and merging but I am doing something wrong. I have my code in R below but I have Stata as well so I am open to Stata solutions.

TL:DR - How can I merge each household to an individual and make children the row/observation INSTEAD of the columns in the datasets.

Thank you.



 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Merging BR and PR files - India - NFHS 1998
Next Topic: Merge IR and KR
Goto Forum:
  


Current Time: Tue Nov 26 12:44:46 Coordinated Universal Time 2024