Matching children's information to parents

#1
Dear Stata users

I am working on the Labor force survey, and I am trying to match children information to parents.

Here the syntax:

use "2012_all.dta"
keep if country == 18
egen familyid = group(hhnum)
gen id =.
recast double id
format id %16.0f
replace id = familyid*100+hhseqnum
save "italia_2606.dta", replace

*2 Combine couple information

use "italia_2606.dta"
sort familyid hhspou
drop if hhspou == 0
drop hhseqnum
renvars, postf (_couple)
rename hhspou_couple hhseqnum
rename familyid_couple familyid
save "female.dta", replace
use "italia_2606.dta", clear
sort familyid hhseqnum
merge 1:1 familyid hhseqnum using "female.dta"
rename _merge couple
save "couple.dta", replace

*Combine Children information - father

use "couple.dta"
drop if hhfath == 0
drop hhseqnum
renvars, postf (_fig)
rename hhfath_fig hhseqnum
drop id_fig
gen id =.
recast double id
format id %16.0f
replace id = familyid*100+hhseqnum
sort id age_fig
by id: gen nfig=_n
keep id nfig age_fig sex_fig nfig mainstat_fig educstat_fig educfild_fig hat97lev_fig hatlfath_fig hatlmoth_fig hatlev1d_fig hhageyg_fig hhage14_fig
reshape wide age_fig sex_fig mainstat_fig educstat_fig educfild_fig hat97lev_fig hatlfath_fig hatlmoth_fig hatlev1d_fig hhageyg_fig hhage14_fig, i (id) j (nfig)
save "figli.dta",replace
use "couple.dta"
merge 1:1 id using "figli.dta"
rename _merge figli
save "couple.dta", replace

*Combine children information - mother

use "couple.dta"
drop if hhmoth == 0
drop hhseqnum
renvars, postf (_fig)
rename hhmoth_fig hhseqnum
drop id_fig
gen id =.
recast double id
format id %16.0f
replace id = familyid*100+hhseqnum
sort id age_fig
by id: gen nfig=_n
keep id nfig age_fig sex_fig nfig mainstat_fig educstat_fig educfild_fig hat97lev_fig hatlfath_fig hatlmoth_fig hatlev1d_fig hhageyg_fig hhage14_fig
reshape wide age_fig sex_fig mainstat_fig educstat_fig educfild_fig hat97lev_fig hatlfath_fig hatlmoth_fig hatlev1d_fig hhageyg_fig hhage14_fig, i (id) j (nfig)
save "figli.dta",replace
use "couple.dta"
merge 1:1 id using "figli.dta"
save "couple.dta", replace


In the final dataset i will have, in the same row, information about reference person, spouse and children.

The problem is that I can't see children's information (in the same row) when they have only ne parent.

Is the last merge wrong?

Thank you very much.
Giulia