Hello,
I am new to Stata and I would like to write a code.
I want to determine the number of children in the women's current union (variable childincurunion).
I have data on : the birth year of the children (variable yearbirthchild) the year of first marriage/cohabitation (yearofmarriage) and data on the total number of alive children that the woman had regarding the number of union that she may had (variable chebalive) .
I am restricting my sample to the number of women who are currently married or living with a man and had only one union.
gen childIncurrunion=0
replace childincurrunion=1 if yearbirthchild>=yearofmarriage (if we believe that the couple has children when they are married and not)
Then, (for this line stata says invalid syntax).
gen numberchildincurrunion=0
if childincurrunion=0
replace numberchildincurrunion=totalnumberofchildren
What's the problem with this syntax ? Is there a correct way to write this ?
Thank you for your help.
I really appreciate it
I am new to Stata and I would like to write a code.
I want to determine the number of children in the women's current union (variable childincurunion).
I have data on : the birth year of the children (variable yearbirthchild) the year of first marriage/cohabitation (yearofmarriage) and data on the total number of alive children that the woman had regarding the number of union that she may had (variable chebalive) .
I am restricting my sample to the number of women who are currently married or living with a man and had only one union.
gen childIncurrunion=0
replace childincurrunion=1 if yearbirthchild>=yearofmarriage (if we believe that the couple has children when they are married and not)
Then, (for this line stata says invalid syntax).
gen numberchildincurrunion=0
if childincurrunion=0
replace numberchildincurrunion=totalnumberofchildren
What's the problem with this syntax ? Is there a correct way to write this ?
Thank you for your help.
I really appreciate it
Comment