The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Dataset use in Stata » Need Help
Re: Need Help [message #8539 is a reply to message #8527] Wed, 11 November 2015 17:21 Go to previous messageGo to previous message
user-rhs is currently offline  user-rhs
Messages: 132
Registered: December 2013
Senior Member
The variable for child's age is b8_i, where i corresponds to the child's entry number in the birth index (bidx), which is the reverse of birth order (bord). I'm not sure what you mean by "current child," and I'll assume here that you mean to say the child is currently alive. The variable for vital status is b5_i.


There are a number of ways to generate the variable "is currently alive and under 5 years old" If the data are in wide format, (e.g. if you have b8_1, b8_2, b8_3,..., b8_n and b5_1, b5_2,...b5_n in the dataset), it is probably easiest for you to reshape it to long (use mum's identifier as the "grouping" variable, the statistical package should automatically generate the child's line number within the grouping variable based on the number after _ in the variable name). Then use if-then statements to generate the alive and under 5 variable.

In Stata, it would look something like (untested code):

reshape long b5_ b8_,i(caseid) j(j)
gen alivelt5=(b5_==1 & b8_<5)
label var alivelt5 "Child is alive and less than 5 years of age"



Another alternative is to leave the data as wide and use a loop to create the alivelt5 variable before reshaping to long (if you plan to analyze the data at the child level), for example (untested code):
*supposing the max # of entries in the birth register was 12, so you have b5_1, b5_2,...b5_12
foreach x of numlist 1/12{
gen alivelt5_`x' =(b5_`x'==1 & b8_`x' <5)
label var alivelt5_`x' "Child is alive and less than 5 years of age"
}

This will produce 12 variables (alivelt5_1, alivelt5_2,..., alivelt5_12). Your next steps depend on your research question. You can sum up all the alivelt5_ variables if you want to do the analysis at the mother level to see how many living children under 5 she has, or you can reshape to long if you want to analyze the data at the individual child level.


hth,
rhs


[Updated on: Wed, 11 November 2015 18:15]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Calculating median age at first sex
Next Topic: Trend analysis of dichotomous categorical outcome variable on stata
Goto Forum:
  


Current Time: Sun Oct 6 20:22:52 Coordinated Universal Time 2024