| Child discipline [message #25269] | 
			Mon, 26 September 2022 09:53   | 
		 
		
			
				
				
				
					
						  
						lprafa
						 Messages: 4 Registered: October 2020 
						
					 | 
					Member  | 
					 | 
		 
		 
	 | 
 
	
		Hi, I have a question regarding the child discipline module and the merging of the child discipline module with the IR file. I need all women's information from the IR file, but I also would like to identify whom among the women in the IR file are the mothers of the children who were randomly selected in the PR file to answer the child discipline questions. I managed to merge easily the women in the IR file with the same women in the PR file, though this is not enough to know if those women are also the children's mothers. I am aware that caregivers answered the child discipline module, hence sometimes fathers or other household members answered (and some of these caregivers are not women 15-49 appearing in the IR file), yet my sample in this case needs to be defined by the women in the IR file (cause I need many other controls included in the IR file), hence I want to identify whom among those women are mothers of the children who were randomly selected. Any suggestion on how to identify these and do the merge most efficiently? Thank you very much for your kind help. 
		
		
		[Updated on: Mon, 26 September 2022 09:53] Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 | 
	| 
		
 | 
	| 
		
 | 
	
		
		
			| Re: Child discipline [message #25321 is a reply to message #25296] | 
			Mon, 03 October 2022 14:40   | 
		 
		
			
				
				
				
					
						  
						Janet-DHS
						 Messages: 938 Registered: April 2022 
						
					 | 
					Senior Member  | 
					 | 
		 
		 
	 | 
 
	
		Following is a response from DHS staff member Tom Pullum: 
 
The Stata code pasted below should do what you want. The crucial variable is hv112.  For children age 0-17 in the PR file, hv112 is the line number of the mother, if she is in the same household. The variable names for the child discipline module are different in different surveys. I use an old version of the merge command, which I prefer. 
 
 
* specify a workspace 
cd e:\DHS\scratch 
 
* Find children selected for the child discipline module 
use "...BUPR71FL.DTA" , clear 
 
* to find the variable names 
lookfor spank 
describe sh174* 
*tab1 sh174* 
 
* to find the variable that gives the line number of the selected child 
lookfor selected 
 
* to find the structure of the data 
*list hv001 hv002 hvidx hv101-hv105 sh159 sh174a if hv001==1, table clean 
 
* save the selected children 
keep if hvidx==sh159 
 
gen cluster=hv001 
gen hh=hv002 
gen ch_line=hvidx 
gen mo_line=hv112 
gen fa_line=hv114 
gen care_line=sh13b 
 
sort cluster hh mo_line 
save BU_selected_children.dta, replace 
 
* Find the mothers 
use "...BUIR71FL.DTA" , clear 
gen cluster=v001 
gen hh=v002 
gen mo_line=v003 
sort cluster hh mo_line 
merge cluster hh mo_line using BU_selected_children.dta 
 
* Now have a file of child/woman pairs 
gen type=_merge 
 
label define type 1 "Woman unmatched with child" 2 "Child unmatched with mother" 3 "Child/mother pair" 
label values type type 
 
tab type 
		
		
		
 |  
	| 
		
	 | 
 
 
 |