Merging 2018 Zambia HR to IR [message #26011] |
Thu, 26 January 2023 22:46 |
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.
|
|
|