The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » Combining mother's info on child row in PR file
Re: Combining mother's info on child row in PR file [message #11339 is a reply to message #11337] Tue, 06 December 2016 09:21 Go to previous messageGo to previous message
lillo?S is currently offline  lillo?S
Messages: 26
Registered: December 2015
Member
Sure and thanks. This is the code:

df <- df %>%
group_by(hhid) %>%
mutate(idmother = ifelse(hv112>0 & under17=="yes", hv112, NA))
df <- df %>%
group_by(hhid) %>%
mutate(agemother = ifelse(!is.na(idmother), hv105[idmother], NA))
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: combinning three files into one file
Next Topic: Child's weight in Kg (1 decimal) variable in SAS
Goto Forum:
  


Current Time: Fri Jan 3 02:37:16 Coordinated Universal Time 2025