Support #2173
openChild number
80%
Description
Hi there,
I am wondering how to distinguish childless and parents not just considering whether they have biological children but also adopted and other type of children. I found that using nchild_dv can only distinguish who has a child under 16 rather then parents and childless as those with 0 child under 16 may have a child older than 16. I found it is a bit confused about this in the dataset even if I read other posts. And how to get the number of child they have regardless the child age and natural or adopted or stepped.
Thank you,
Shiyu
Updated by Understanding Society User Support Team about 2 months ago
Dear Shiyu Yuan,
You can use the bcx_N, acx_N, scx_N, fcx_N from the xhhrel file and combine it with the relevant lvrel variables (https://www.understandingsociety.ac.uk/documentation/mainstage/variables/?s=Lvrel&post_type=variable_mainstage&submit=Search).
Kind regards,
Piotr Marzec
UKHLS User Support
Updated by Understanding Society User Support Team about 2 months ago
- % Done changed from 0 to 80
- Private changed from Yes to No
Updated by Shiyu Yuan about 2 months ago
Thank you very much!
Just double check with you, for my understanding the xhhrel file is a cross wave file right. Will I be able to identify this child number each wave such as wave 2 in this way?
Thank you.
Updated by Understanding Society User Support Team about 2 months ago ยท Edited
- Category changed from Data analysis to Data management
- Status changed from New to Feedback
Hi Shiyu,
You're right, since you need that for each wave using xhhrel will not work. You can use egoalt file and do something like this (using wave 1 as an example):
global in "D:/stata/stata13_se"
cd "D:/number of children"
use "$in/ukhls/a_egoalt", clear
fre a_relationship_dv
//keep only biological, step, adopt, foster parents
keep if inrange(a_relationship_dv,9,12)
fre a_relationship_dv
//count the number of times each pidp appears, which gives you the number of children of all ages (each row is one parent - child relationship)
bysort pidp: gen numchild = _N
fre numchild
//keep only one observation per person
bysort pidp: keep if _n==1
fre numchild
//link to indall
merge 1:1 pidp using "$in/ukhls/a_indall"
//generate your final variable
gen a_numchild=0
replace a_numchild=numchild if numchild!=.
//there are no instances where a_nchild_dv>a_numchild, this is correct since a_nchild_dv includes only children<16 y.o. and excludes foster children
count if a_nchild_dv>a_numchild
//your new variable captures resident children aged >15 y.o.
count if a_nchild_dv<a_numchild
*To run this on all waves, put the code above in a loop, e.g.: *
foreach w in a b c d e f g h i j k l m {
use "$in/ukhls/`w'_egoalt", clear
fre `w'_relationship_dv
//keep only biological, step, adopt, foster parents
keep if inrange(`w'_relationship_dv,9,12)
fre `w'_relationship_dv
//count the number of times each pidp appears, which gives you the number of children of all ages (each row is one parent - child relationship)
bysort pidp: gen numchild = _N
fre numchild
//keep only one observation per person
bysort pidp: keep if _n==1
fre numchild
//link to indall
merge 1:1 pidp using "$in/ukhls/`w'_indall"
//generate your final variable
gen `w'_numchild=0
replace `w'_numchild=numchild if numchild!=.
//there are no instances where `w'_nchild_dv>`w'_numchild, this is correct since `w'_nchild_dv includes only children<16 y.o.
count if `w'_nchild_dv>`w'_numchild
//your new variable captures resident children aged >15 y.o.
count if `w'_nchild_dv<`w'_numchild
}
What is left are non-resident children and since you need the number of such children it is not possible to get this information for everyone in the sample and for every wave because the relevant question was asked only in wave 1: a_nrelsw11. The other thing you need to consider is how respondents understood the wording: "How many son(s) or daughter(s) do you have, excluding those living here at the moment?", it doesn't specify if this was about adopted, foster, and step children as well. This will be easier if you need a binary has children vs. no children, as it was asked in waves 1, 3, 5, 7, 9, 11, 13.
I hope this helps.
Best wishes,
Piotr Marzec
UKHLS User Support