I do not know why, but IPUMS-USA does not provide the number of children under 18 in household; it only provides the number of own children of any age (NCHILD) and the number of own children age 4 and under residing with each individual (NCHLT5). However, for those of us who are interested in using IPUMS-USA data to estimate the labor market impact of parenthood, knowing the number of children under 18 in household may be useful. Below is the Stata code to accomplish that:
gen kid17=.
forv i=1(1)54 {
by year serial famunit subfam famsize: ///
egen kids=total(age<=17 & momloc==`i’)
by year serial famunit subfam famsize: ///
replace kid17=kids if pernum==`i’ & sex==1
drop kids
}
forv i=1(1)54 {
by year serial famunit subfam famsize: ///
egen kids=total(age<=17 & poploc==`i’)
by year serial famunit subfam famsize: ///
replace kid17=kids if pernum==`i’ & sex==0
drop kids
}
IPUMS-USA provides family relationship pointers, MOMLOC and POPLOC, that indicate whether the person’s mother or father lived in the same household. If the person did live with his or her parent, then MOMLOC and POLOC give you the person number (PERNUM) of the parent(s).
For my own purpose, I recoded gender from “1 = Male, 2 = Female” to “0 = Male, 1 = Female,” and restricted the PERNUM to check person #1 through 54. Depending on the survey year and your sampling restriction rule, you may need to change 54 to the highest PERNUM in your sample.