Age at first birth [message #12955] |
Mon, 21 August 2017 13:31 |
kbietsch_avenir
Messages: 2 Registered: August 2017
|
Member |
|
|
Hello,
I am trying to reproduce a number from the final report/stat compiler:
The percent of women 20-24 who gave birth before the age of 18. The report says 35.7%
I keep getting a higher number, and wonder if I am not taking into account unmarried women.
* Set up svy paramaters
gen wt=v005/1000000
svyset v021 [pw=wt], strata(v023)
gen agefb= (v211-v011)/12
gen fbu18 = 1 if agefb<18
replace fbu18=0 if agefb>=18
* All women factor
gen aw = awfactt/100
* Check the denominator
tab fbu18 [iw=aw*wt]
Alternatively, I tried bringing nonmarried women in from the household roster, but still found a percentage over 40%. Can you help point me in the right direction?
Cheers,
Kristin
[Updated on: Mon, 21 August 2017 13:56] Report message to a moderator
|
|
|
Re: Age at first birth [message #12956 is a reply to message #12955] |
Mon, 21 August 2017 15:54 |
kbietsch_avenir
Messages: 2 Registered: August 2017
|
Member |
|
|
I believe I figured it out (at least was able to replicate stat compiler. I found a similar thread in the weighting section. Here is my code in case anyone has the same question in the future:
*******************************************************
clear all
use "C:\Users\KBietsch\Files\DHS Data\Bangladesh\BDIR71FL.DTA", clear
keep if v013==2
keep v005 awfactt v201 v211 v011 v106
gen agefb= (v211-v011)/12
gen fbu18 = 1 if agefb<18
replace fbu18=0 if agefb>=18
* brute force
gen numerator=fbu18*(v005/1000000)
gen denominator1=v005/1000000
gen denominator2=(v005/1000000)*(awfactt/100)
collapse (sum) numerator denominator*
gen mean1=numerator/denominator1
gen mean2=numerator/denominator2
list, table clean
********** Education **********
clear all
use "C:\Users\KBietsch\Files\DHS Data\Bangladesh\BDIR71FL.DTA", clear
keep if v013==2
keep v005 awfactt v201 v211 v011 v106 awfacte
gen agefb= (v211-v011)/12
gen fbu18 = 1 if agefb<18
replace fbu18=0 if agefb>=18
* brute force
gen numerator=fbu18*(v005/1000000)
gen denominator1=v005/1000000
gen denominator2=(v005/1000000)*(awfacte/100)
collapse (sum) numerator denominator*, by(v106)
gen mean1=numerator/denominator1
gen mean2=numerator/denominator2
list, table clean
********** Wealth **********
clear all
use "C:\Users\KBietsch\Files\DHS Data\Bangladesh\BDIR71FL.DTA", clear
keep if v013==2
keep v005 awfactt v201 v211 v011 v106 awfactw v190
gen agefb= (v211-v011)/12
gen fbu18 = 1 if agefb<18
replace fbu18=0 if agefb>=18
* brute force
gen numerator=fbu18*(v005/1000000)
gen denominator1=v005/1000000
gen denominator2=(v005/1000000)*(awfactw/100)
collapse (sum) numerator denominator*, by(v190)
gen mean1=numerator/denominator1
gen mean2=numerator/denominator2
list, table clean
|
|
|