The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Fertility » Please help! DHS Malawi youth-specific
Please help! DHS Malawi youth-specific [message #2020] Mon, 14 April 2014 16:40 Go to next message
malayaka is currently offline  malayaka
Messages: 18
Registered: March 2014
Member
Hello,

I am using STATA 11.2 and I am having difficulty generating the same (DHS Malawi 2010) percents/figures for:

1) Women ages 20-24 yrs who married by age 18
2) Women ages 20-24 yrs who gave birth (first birth) by age 18

Below are the STATA codes I used for "Married by age 18," which I will then replicate for "Women ages 20-24 yrs who gave birth by age 18." I then plan to crosstab by wealth, residence (urban/rural), and region. Can someone please assist and tell me the correct code(s)/approach to produce the same figures?

STATA CODE:
use v005 v012 v013 v021 v022 v023 v024 v025 v044 v101 v102 v106 v149 v155
v190 v201 v212 v313 v384a v384b v384c v463z v501 v502 v511 v536 v613 v714
v717 v731 v739 v763a d005 d108 d124 d125 using "/Users/Desktop/MWIR61FL.DTA

generate weight = v005/1000000
svyset [iweight=weight], psu(v021) strata(v023)

************************
* Married by age 18
************************
* Age group (20-24 yrs) and married by age 18
svy: tabulate v511 v013 if v013==2

* By age group (15-19 yrs), married by age 18 and wealth
quintile
svy: tabulate v511 190 if v013==2, column

* By age group (15-19 yrs), married by age 18 and place of
residence (urban/rural)
svy: tabulate v511 102 if v013==2, column

* By age group (15-19 yrs), married by age 18 and region
(North, Central, South)
svy: tabulate v511 101 if v013==2, column

Thank you in advance.

[Updated on: Tue, 15 April 2014 13:39]

Report message to a moderator

Re: Please help! DHS Malawi youth-specific [message #2036 is a reply to message #2020] Wed, 16 April 2014 15:35 Go to previous messageGo to next message
Liz-DHS
Messages: 1516
Registered: February 2013
Senior Member
Dear User,
Can you please provide the table number and page number in the report you are trying to replicate?
Thank you!
Re: Please help! DHS Malawi youth-specific [message #2037 is a reply to message #2036] Wed, 16 April 2014 16:01 Go to previous messageGo to next message
malayaka is currently offline  malayaka
Messages: 18
Registered: March 2014
Member
Thank you, Liz.

Attached are the DHS charts

p. 49, Table 4.6 (Age at first birth)
p. 76, Table. 6.3 (Age at first marriage)

I am only narrowing it down to the 20-24 yr old (women). I will then cross tab with wealth, residence (urban/rural), and region.

Thank you in advance.
Re: Please help! DHS Malawi youth-specific [message #2038 is a reply to message #2037] Wed, 16 April 2014 17:44 Go to previous messageGo to next message
user-rhs is currently offline  user-rhs
Messages: 132
Registered: December 2013
Senior Member
Liz C.S.--I have provided Malayaka some example code that I wrote using the Ethiopia 2011 DHS Final report table 4.6 (I didn't have access to the Malawi data) via private message, which I reproduce below.

---


Malayaka, I was able to replicate the 2011 Ethiopia DHS Final Report using the code below after calling in the dataset:

gen wt=v005/1000000

svyset [pw=wt] /*you can specify cluster and strata if you want for central tendency, but cluster and strata affect standard errors, not proportions*/

*create indicator variables of "married by" for a specific age (15, 18, 20, 22, 25)
gen mb15=(v511<15)
label var mb15 "married by 15"
gen mb18=(v511<18)
gen mb20=(v511<20)
gen mb22=(v511<22)
gen mb25=(v511<25)

svy: tab v013 mb15,row count
svy: tab v013 mb18,row count
svy: tab v013 mb20,row count
svy: tab v013 mb22,row count
svy: tab v013 mb25,row count


Table from DHS report (png) and my output (txt) are attached. As you can see for the row proportions where "mb15==1," my proportions are off only by some small decimal points from what was reported in the report. You can use this same formula to do your fertility and domestic and sexual violence variables. Unfortunately, I have never done domestic and sexual abuse analysis, so I can't tell you which variables you should use, but the code given here will give you a headstart.

HTH,
RHS
  • Attachment: example.png
    (Size: 46.70KB, Downloaded 1001 times)
  • Attachment: example.txt
    (Size: 6.60KB, Downloaded 1063 times)
Re: Please help! DHS Malawi youth-specific [message #2040 is a reply to message #2038] Wed, 16 April 2014 23:19 Go to previous messageGo to next message
Liz-DHS
Messages: 1516
Registered: February 2013
Senior Member
Thank you RHS
Re: Please help! DHS Malawi youth-specific [message #2045 is a reply to message #2037] Thu, 17 April 2014 14:00 Go to previous messageGo to next message
Liz-DHS
Messages: 1516
Registered: February 2013
Senior Member
Dear User,
Malawi 2010 P49 Table 4.6
I am not a programmer but here is some of the CSPro code for this table "Age at 1st Birth". It may help in figuring things out.

crosstab float(1) T406 v013w+age20t+age25t agebirth+nobirth+nummed
exclude(specval, rowzero, colzero, totals, percents)
{+US}
title( "Table 4.6 Age at first birth"," ",
"Percentage of women age 15-49 who gave birth by exact ages, percentage who",
"have never given birth, and median age at first birth, according",
"to current age, Malawi 2010" )
stub( "Current age" );
{US+}

Note:
The row variables are:
v013w - age - Value labels 1 15-19, 2 20-24, 3 25-29, 4 30-34, 5 35-39, 6 40-44, 7 45-49, 8 50-54, 9 55-59
age20 - age - Women Age - Value labels 1 20-49
age25t Value labels 1 25-49
The column variables are:
agebirth - Percentage who gave birth by exact age - Value labels 1 15, 2 18, 3 20, 4 22, 5 25
nobirth - Percentage who have never given birth - Value labels 1 Percentage who have never given birth
nummed - Value labels - 1 number of women, 2 median age at 1st birth
{ Table 4.6 processing }
jtot = tblcol( t406 ) - 1;
jmax = jtot - 1;
do j = 0 while j <= jmax by 1
t406[*,j] = t406[*,j] * 100 / t406[*,jtot];
if j > 0 & j < jmax then { to have births by exact ages }
t406[*,j] = t406[*,j] + t406[*,j-1]; { it's necessary to accumulate }
endif;
enddo;
t406[0,1:jmax-1] = default; { default row for women 15-19 }
t406[1,3:jmax-1] = default; { default row for women 20-24 }
t406[*,jtot+1] = tblmed( column t406w[*,0:maxage] intervals(highest default) );
itot = tblrow( t406 );
t406[itot-1,3:jmax-1] = default; { default row for women 20-49 }
do i = 0 while i <= itot by 1
maxval = (i+3) * 5;
if i = itot then { women 25-49 }
maxval = 25
elseif i = itot - 1 then { women 20-49 }
maxval = 20
endif;
if t406(i,jtot+1) < 0 | t406(i,jtot+1) >= maxval then
t406(i,jtot+1) = default
endif;
enddo;

{ ------------------------------------------------------------ ------------ }
{ table 4.6 }

box V212 => agebirth;
<15 => 1;
15-17 => 2;
18-19 => 3;
20-21 => 4;
22-24 => 5;
=> notappl;
endbox;
nobirth = ( V201 = 0 );
t = xtab( t406, rweight );
if emsample then
agebirth = notappl;
nobirth = 1;
t = xtab( t406, singwgt*rweight );
endif;
agemed = V212;
if V201 = 0 | agemed > maxage then agemed = maxage endif;
t = xtab( t406w, rweight );
if emsample then
agemed = maxage;
t = xtab( t406w, singwgt*rweight );
endif;

P76, Table 6.3 Age at 1st marriage

crosstab float(1) t603 v013w+age20t+age25t+age20tm+age25tm
colt603+nevmarr+numbmed1 isex
exclude(rowzero,colzero,percents,totals,specval)
{+US}
title( "Table 6.3 Age at first marriage"," ",
"Percentage of women and men age 15-49 who were first married by",
"specific exact ages and median age at first marriage,",
"according to current age, Malawi 2010" )
stub( "Current age" );

Row Variables:
v013w - age - Value labels 1 15-19, 2 20-24, 3 25-29, 4 30-34, 5 35-39, 6 40-44, 7 45-49, 8 50-54, 9 55-59
age20 - age - Women Age - Value labels 1 20-49
age25t Value labels 1 25-49
Age20tm - value label 1 20-54
age25tm - value label 1 25-54
Column Variables:
Colt603
nevmarr value labels 1 Percentage never married
numbmed1 value labels 1 Number, 2 median age at first marriage

Layer variables:
isex value labels 1 Female, 2 Men

{ Table 6.3 processing }
jtot = tblcol( t603 ) - 1;
jmax = jtot - 1;
itot = tblrow( t603 );
do k = 0 while k <= 1 by 1 { for each sex }
do j = 0 while j <= jmax by 1
t603[*,j,k] = t603[*,j,k] * 100 / t603[*,jtot,k];
if j > 0 & j < jmax then { to be married by exact age }
t603[*,j,k] = t603[*,j,k] + t603[*,j-1,k]; { it's necessary to accumulate }
endif;
enddo;
t603[0, 1:jmax-1,k] = default; { default for age 15-19 }
t603[1, 3:jmax-1,k] = default; { default for age 20-24 }
temp = tblrow( t603, age20t );
t603[temp,3:jmax-1,k] = default; { default for age 20-49 }
temp = tblrow( t603, age20tm );
t603[temp,3:jmax-1,k] = default; { default for age 20-49, for men }
t603[*,jtot+1,k] = tblmed( column t603w[*,0:maxage,k] intervals(highest default) );
{ check censoring }
do i = 0 while i <= itot by 1
maxval = (i+3) * 5;
temp = itot - i; { last four rows need special treatment }
if temp in 0,2 then { men 25-59 and men/women 25-49 }
maxval = 25
elseif temp in 1,3 then { men 20-59 and men/women 20-49 }
maxval = 20
endif;
if t603(i,jtot+1,k) < 0 | t603(i,jtot+1,k) >= maxval then
t603(i,jtot+1,k) = default;
endif;
enddo;
enddo;

{ ------------------------------------------------------------ -------- }
{ table 6.3 women}

{ assign notappl to men variables }
age20tm = notappl;
age20m = notappl;
age25tm = notappl;
age25m = notappl;

{ now age for women }
age20t = ( V012 >= 20 );
age20 = age20t;
age25t = ( V012 >= 25 );
age25 = age25t;
age15 = ( V012 in 15:24 );
box V511 => colt603;
<15 => 1;
15-17 => 2;
18-19 => 3;
20-21 => 4;
22-24 => 5;
=> notappl;
endbox;
if V501 = missing then colt603 = notappl endif;
nevmarr = ( V501 = 0 );
t = xtab( t603, rweight );
if emsample then
colt603 = notappl;
nevmarr = 1;
t = xtab( t603, rweight*singwgt );
endif;
agemed = V511;
if V511 = notappl | V511 > maxage then agemed = maxage endif;
t = xtab( t603w, rweight );
if emsample then
xagemed = agemed;
agemed = maxage;
t = xtab( t603w, rweight*singwgt );
agemed = xagemed;
endif;

{ ------------------------------------------------------------ -------- }

{table 6.3 Men}

box MV511 => colt603;
<15 => 1;
15-17 => 2;
18-19 => 3;
20-21 => 4;
22-24 => 5;
=> notappl;
endbox;
if MV501 = missing then colt603 = notappl endif;
nevmarr = ( MV501 = 0 );
t = xtab( t603, rweight );
agemed = MV511;
if MV511 = notappl | MV511 > maxage then agemed = maxage endif;
t = xtab( t603w, rweight )

[Updated on: Thu, 17 April 2014 14:28]

Report message to a moderator

Re: Please help! DHS Malawi youth-specific [message #9346 is a reply to message #2020] Wed, 16 March 2016 05:12 Go to previous messageGo to next message
Sahara is currently offline  Sahara
Messages: 2
Registered: March 2016
Member
malayaka wrote on Mon, 14 April 2014 16:40
Hello,

I am using STATA 11.2 and I am having difficulty generating the same (DHS Malawi 2010) percents/figures for:

1) Women ages 20-24 yrs who married by age 18
2) Women ages 20-24 yrs who gave birth (first birth) by age 18

Below are the STATA codes I used for "Married by age 18," which I will then replicate for "Women ages 20-24 yrs who gave birth by age 18." I then plan to crosstab by wealth, residence (urban/rural), and region. Can someone please assist and tell me about the Crazy Bulk program on https://deadliftdonkey.com/my-crazy-bulk-review so the correct code(s)/approach to produce the same figures?

STATA CODE:
use v005 v012 v013 v021 v022 v023 v024 v025 v044 v101 v102 v106 v149 v155
v190 v201 v212 v313 v384a v384b v384c v463z v501 v502 v511 v536 v613 v714
v717 v731 v739 v763a d005 d108 d124 d125 using "/Users/Desktop/MWIR61FL.DTA

generate weight = v005/1000000
svyset [iweight=weight], psu(v021) strata(v023)

************************
* Married by age 18
************************
* Age group (20-24 yrs) and married by age 18
svy: tabulate v511 v013 if v013==2

* By age group (15-19 yrs), married by age 18 and wealth
quintile
svy: tabulate v511 190 if v013==2, column

* By age group (15-19 yrs), married by age 18 and place of
residence (urban/rural)
svy: tabulate v511 102 if v013==2, column

* By age group (15-19 yrs), married by age 18 and region
(North, Central, South)
svy: tabulate v511 101 if v013==2, column

Thank you in advance.


I wonder what were your findings on this study.

[Updated on: Sat, 17 September 2016 10:36]

Report message to a moderator

Re: Please help! DHS Malawi youth-specific [message #16637 is a reply to message #2020] Fri, 08 February 2019 07:43 Go to previous messageGo to next message
Arectie is currently offline  Arectie
Messages: 1
Registered: February 2019
Member
malayaka wrote on Mon, 14 April 2014 16:40
Hello,

I am using STATA 11.2 and I am having difficulty generating the same (DHS Malawi 2010) percents/figures for:

1) Women ages 20-24 yrs who married by age 18
2) Women ages 20-24 yrs who gave birth (first birth) by age 18

Below are the STATA codes I used for "Married by age 18," which I will then replicate for "Women ages 20-24 yrs who gave birth by age 18." I then plan to crosstab by wealth, residence (urban/rural), and region. Can someone please assist and tell me the correct code(s)/approach to produce the same figures? https://www.stlcurioshoppe.com/v-tight-gel-review/

STATA CODE:
use v005 v012 v013 v021 v022 v023 v024 v025 v044 v101 v102 v106 v149 v155
v190 v201 v212 v313 v384a v384b v384c v463z v501 v502 v511 v536 v613 v714
v717 v731 v739 v763a d005 d108 d124 d125 using "/Users/Desktop/MWIR61FL.DTA

generate weight = v005/1000000
svyset [iweight=weight], psu(v021) strata(v023)

************************
* Married by age 18
************************
* Age group (20-24 yrs) and married by age 18
svy: tabulate v511 v013 if v013==2

* By age group (15-19 yrs), married by age 18 and wealth
quintile
svy: tabulate v511 190 if v013==2, column

* By age group (15-19 yrs), married by age 18 and place of
residence (urban/rural)
svy: tabulate v511 102 if v013==2, column

* By age group (15-19 yrs), married by age 18 and region
(North, Central, South)
svy: tabulate v511 101 if v013==2, column

Thank you in advance.
I wonder what were your findings on this study.

[Updated on: Tue, 12 February 2019 04:31]

Report message to a moderator

Re: Please help! DHS Malawi youth-specific [message #18616 is a reply to message #9346] Mon, 13 January 2020 01:33 Go to previous messageGo to next message
florencioagullette is currently offline  florencioagullette
Messages: 1
Registered: January 2020
Member
Sahara wrote on Wed, 16 March 2016 05:12
malayaka wrote on Mon, 14 April 2014 16:40
Hello,

I am using STATA 11.2 and I am having difficulty generating the same (DHS Malawi 2010) percents/figures for:

1) Women ages 20-24 yrs who married by age 18
2) Women ages 20-24 yrs who gave birth (first birth) by age 18

Below are the STATA codes I used for "Married by age 18," which I will then replicate for "Women ages 20-24 yrs who gave birth by age 18." I then plan to crosstab by wealth, residence (urban/rural), and region. Can someone please assist and tell me about the Crazy Bulk program on https://www.giannasgrille.com/ so the correct code(s)/approach to produce the same figures?

STATA CODE:
use v005 v012 v013 v021 v022 v023 v024 v025 v044 v101 v102 v106 v149 v155
v190 v201 v212 v313 v384a v384b v384c v463z v501 v502 v511 v536 v613 v714
v717 v731 v739 v763a d005 d108 d124 d125 using "/Users/Desktop/MWIR61FL.DTA

generate weight = v005/1000000
svyset [iweight=weight], psu(v021) strata(v023)

************************
* Married by age 18
************************
* Age group (20-24 yrs) and married by age 18
svy: tabulate v511 v013 if v013==2

* By age group (15-19 yrs), married by age 18 and wealth
quintile
svy: tabulate v511 190 if v013==2, column

* By age group (15-19 yrs), married by age 18 and place of
residence (urban/rural)
svy: tabulate v511 102 if v013==2, column

* By age group (15-19 yrs), married by age 18 and region
(North, Central, South)
svy: tabulate v511 101 if v013==2, column

Thank you in advance.
I wonder what were your findings on this study.

thats really helpfull..
Re: Please help! DHS Malawi youth-specific [message #18774 is a reply to message #18616] Tue, 18 February 2020 05:11 Go to previous messageGo to next message
MaryRob is currently offline  MaryRob
Messages: 1
Registered: February 2020
Member
Hello, I am new to your forum as of today.. I am from Alberta, Canada. I am really happy to be a member of this forum. thanks.
Re: Please help! DHS Malawi youth-specific [message #22045 is a reply to message #2038] Mon, 25 January 2021 02:48 Go to previous messageGo to next message
AlbertGonzales is currently offline  AlbertGonzales
Messages: 1
Registered: November 2020
Member
user-rhs wrote on Wed, 16 April 2014 17:44
Liz C.S.--I have provided Malayaka some example code that I wrote using the Ethiopia 2011 DHS Final report table 4.6 (I didn't have access to the Malawi data) via private message, which I reproduce below.

---


Malayaka, I was able to replicate the 2011 Ethiopia DHS Final Report using the code below after calling in the dataset:

gen wt=v005/1000000

svyset [pw=wt] /*you can specify cluster and strata if you want for central tendency, but cluster and strata affect standard errors, not proportions*/

*create indicator variables of "married by" for a specific age (15, 18, 20, 22, 25)
gen mb15=(v511<15)
label var mb15 "married by 15"
gen mb18=(v511<18)
gen mb20=(v511<20)
gen mb22=(v511<22)
gen mb25=(v511<25)

svy: tab v013 mb15,row count
svy: tab v013 mb18,row count
svy: tab v013 mb20,row count
svy: tab v013 mb22,row count
svy: tab v013 mb25,row count

Table from DHS report (png) and my output (txt) are attached. As you can see for the row proportions where "mb15==1," my proportions are off only by some small decimal points from what was reported in the report. You can use this same formula to do your fertility and domestic and sexual violence variables. Unfortunately, I have never done domestic and sexual abuse analysis, so I can't tell you which variables you should use, but the code given here will give you a headstart.

HTH,
RHS

specific goal for the coverage of interventions for young people


https://thefecaltransplantfoundation.org/phentermine-over-th e-counter/
Re: Please help! DHS Malawi youth-specific [message #22070 is a reply to message #22045] Wed, 27 January 2021 04:18 Go to previous message
phentermineotc is currently offline  phentermineotc
Messages: 1
Registered: January 2021
Member
Thank you RHS
Previous Topic: Gender of the first born child
Next Topic: Children under 5 in Women's File
Goto Forum:
  


Current Time: Sat Dec 7 09:12:52 Coordinated Universal Time 2024