Children under 18 in CPS Household

I am trying to create a variable for number children under 18 in the household. My code is returning nonsensical values. Do I only use relate to finding them? Thanks.

In order to identify the number of children under 18 in a household you will want to make use of RELATE and AGE. RELATE will help you identify who is a child and AGE will allow you identify the age of each child.

If you still have issues with your code, you can email and we will work to figure out what the issue is.

Thanks Michelle. I think I figured it out. But now I have an additional question regarding single mother households. I am trying to create single mother households in CPS. I followed a previous answer from IPUMS ((how to create a measure for the percentage of children in single-parent households?)

I have followed all the steps until the merge. But the merge keeps error saying year serial do not uniquely identify observations in the using data. I do not have any duplicates (I checked for that). I am not sure if it’s the right way to create single mother households.

The only difference between your analysis and the forum post you reference would be that you will want to limit your analysis to female-headed households. Are you then merging using YEAR, DATANUM, and SERIAL? Maybe you can share your code with us either here (or email and we can help pinpoint the issue.


Here is the code I am using :

gen single_mom =1 if (relate==0101 & married==0 & nchild >0)

replace single_mom = 0 if single_mom==.

drop if single_mom==0

save single_mom, replace


*use “cps_ukcpr_wrd_data”

merge m:1 year serial using “single_mom”

rename _merge merge3

save cps_ukcpr_wrd_data,replace*

Does the file you merge with (cps_ukcpr_wrd_data) have any manipulations from the original data set? I was able to successfully merge " single_mom" with the original extract using your code. Maybe try re-saving the extract and re-running your code.

Yes I did manipulate the data. But I will re save and re merge it. Thanks.