Hi everyone,

I am using CPS data and I am trying to estimate the effect of a policy change on the share of teenage mothers. I am using a difference-in-differences framework.

As of now, I have written the code below to get the 'stock' of teenage mothers and female teenagers.

Code:
// Generate variable for total number of mothers
gen mother = sex==2 & nchild>0 if !missing(sex, nchild)
label var mother "Mother"

// Generate variable for number of teenage mothers (contemporaneous)
gen teenagemother= sex ==2 & nchild>0 & inrange(age, 14, 19) if !missing(nchild, age)
label var teenagemother "Teenage mother"

// Generate share of new teenage mothers
egen totalteenagemothers=total(teenagemother*asecwt), by(statefip year)
label var totalteenagemothers "Total teenage mothers

//Generate share of female teenagers 
gen femaleteenager= sex==2 & inrange(age, 14, 19) if !missing(age)
label var femaleteenager "Female teenager"

// Generate total number of female teenagers 
egen totalfemaleteenagers=total(femaleteenager*asecwt), by(statefip year)
label var totalfemaleteenagers "Total female teenager"

/// Estimate prevalance of teenage mothers (female teenagers as comp group, per 1000 population)
gen shareofteenagemothers2=(totalteenagemothers/totalfemaleteenagers)*1000 
label var shareofteenagemothers2 "Share of teenage mothers (per 1000 population)"

However, I am more interested in the 'flow' variable, i.e. the teenage mothers who have had a child in the last year (or in essence, the number of newborns) as well as the flow of new female teenagers. This would allow me to further tease out variation caused by my policy change. Could anyone please help in how I could go about constructing the desired variables of the flow of new teenage mothers and flow of female teenagers?

I have started by constructing the following variables shown below, but I am not sure if this is on the right track as the number of female teenagers is still defined as a stock variable and I am not sure I have correctly identified the number of new teenage mothers who have had a child in the last year.

Code:
// Generate indicator variable for newborns
gen newborn= age<=1 if !missing(age)
label var newborn "New-born baby"

// Generate number of newborns by household birth quarter and year 
egen newbornsbyhh = total(newborn), by(hrhhid birthqtr year)
label var newbornsbyhh "New-borns by birth-quarter, year, and household"

gen newteenagemother = mother==1 & inrange(age, 13, 19) & newbornsbyhh>0 if !missing(mother,age, newbornsbyhh)
label var newteenagemother "New teenage mother"

egen  totalnewteenagemothers=total(newteenagemother*asecwt), by(statefip year)
label var totalnewteenagemothers "Total new teenage mother"

egen totalfemaleteenagers=total(femaleteenager*asecwt), by(statefip year)
label var totalfemaleteenagers "Total female teenagers"

gen shareoftotalnewteenagemothers=(totalnewteenagemothers/totalfemaleteenagers)*1000 
label var shareoftotalnewteenagemothers "Share of new teenage mothers"

Another question I had is is it possible to do quarterly analysis when I only have annual data? I do have the quarter of birth of an individual, so I was wondering if it is possible to further extract more variation for my data. Is there any way I could look at the impact of the policy change on the outcome described above on a quarterly basis?

Thank you so much in advance.

Best regards
Ola