The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Nutrition and Anthropometry » Calculation age
Calculation age [message #15504] Fri, 03 August 2018 10:04
roxanne is currently offline  roxanne
Messages: 1
Registered: July 2018
Hi DHS team,

I'm currently working with the BDHS 2014 KR dataset, using data of children < 6 months. I'm using STATA 15.

I have a question regarding calculating age and the categories of the age variable hw1. I want to calculate z-scores and create an age in weeks variable. I hope you can help!

1. I calculated the age, in days, weeks and in months. If I categorize my age in months I get different frequencies per category (0 to 6) than the categories of hw1 (0 to 6). If i tab the ages in months and in days against hw1 I can see that children of for example 4 days are both code as 0 months and 1 month in hw1.. Also there seems to be overlap in ages if i tab my age in months with hw1. Did I do something wrong or am I missing something? How did you categorize hw1?

I used the following stats commands (I renamed hw1 age and hw16 dayb):

gen bdate=mdy(b1, dayb, b2) if dayb <=31 // 6 missing values (b1 no missing, dayb 6 dont know, b2 no missing)
replace bdate=mdy(b1, 15, b2) if dayb>31 // if missing than code as day 15 // are the 6 missing
gen aged=mdate-bdate // age in days
gen agew=(mdate-bdate)/7 // age in weeks, not sure if this is correct way to do it
gen agem=(mdate-bdate)/30.4375 // age in months, as advised on DHS forum in earlier thread

gen agem2=agem
recode agem2 (min/0.999 = 0) (1/1.999 = 1) (2/2.999 = 2) (3/3.999 = 3) (4/4.999 = 4) (5/5.999 = 5) (6/6.999 = 6)
tab age agem2 --> different frequencies per category??

tab agem age if age==0
tab agem age if age==1
tab agem age if age==2
tab agem age if age==3
tab agem age if age==4
tab agem age if age==5
tab agem age if age==6
--> overlap in age per category??

2. The reason I am doing this is that I want to make a variable with age in weeks. If I am doing anything wrong so far, how can I create a variable with age in weeks?

Your help would be very much appreciated!

Kind regards,
Previous Topic: replicating children 6-23 month
Next Topic: Problem in height/age Z-score (HAZ) in DHS data
Goto Forum:

Current Time: Sat Jul 20 15:47:28 Coordinated Universal Time 2024