Dear Statlisters

I am working on household survey data. Here I have variables on responses by household head on women's freedom of mobility and women's own perception about her freedom of mobility (response given by women within household of age 15 years and older). I want to create household-level variables. For which first, I need to create two variables, separately for wife and daughter in a household. Secondly I want to match wife's variable with her husband and daughter's variable with her father within a household which I think I can create as a product of wife's response with household head and daughter's response with household head.
Below is the sample data and the code I have used to create these variables.

Code:
clear

input double hhid float pid age gender rel_head head_response women_response 

101000 1 48 2 1 0 .
101000 2 39 1 2 0 1
101000 3 12 1 3 0 .
101000 4 16 1 3 0 1
101000 5 6  1 3 0 .
102000 1 50 2 1 1 .
102000 2 40 1 2 1 0
102000 3 15 1 3 1 1
102000 4 10 2 3 1 .
103000 1 45 2 1 1 . 
103000 2 36 1 2 1 1
103000 3 10 1 3 1 .
104000 1 60 2 1 0 . 
104000 2 52 1 2 0 0 
104000 3 27 2 3 0 . 
104000 4 24 2 3 0 .
104000 5 22 1 3 0 0
104000 6 18 1 3 0 0 
105000 1 42 2 1 1 . 
105000 2 32 1 2 1 1
105000 3 10 1 3 1 .
105000 4 12 1 3 1 .
105000 5 6  2 3 1 .

end

label def gender 1 "Female" 2 "Male"
label val gender gender
label var rel_head "Relationship to Head"
label def rel_head 1 "Head" 2 "Spouse" 3 "Son/Daughter"
label val rel_head rel_head
labe var head_response "Household Head Response on women's mobility"
label def head_response 0 "Disagree" 1 "Agree"
label var women_response "Women response on her own mobility"
labe def women_response 0 "Disagree" 1 "Agree"
label val head_response head_response
label val women_response women_response

gen wife_response=women_response if rel_head==2
gen daughter_response=women_response if rel_head==3

bys hhid: egen husband_wife_resp=max(wife_response * head_response)
bys hhid: egen father_daughter_resp=max(daughter_response * head_response)
I just want to make sure whether this code is correct or maybe is there another way of doing it?
Thanks in advance.