The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Dataset use in Stata » Survival Status in Stata
Survival Status in Stata [message #10962] Thu, 13 October 2016 07:26 Go to next message
DHS user is currently offline  DHS user
Messages: 102
Registered: February 2013
Senior Member
How do I derive the survival status of the preceding child in using the kids recode file in Stata?
Re: Survival Status in Stata [message #10963 is a reply to message #10962] Thu, 13 October 2016 07:28 Go to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 2313
Registered: February 2013
Senior Member
Following is a response from Senior DHS Stata Specialist, Tom Pullum:

Quote:
Here are some Stata lines that will put successive children onto the same record. I have set it up for the BR file for a Malawi survey but you could use either the BR or KR file for any survey. You can use b5 for the older child in the pair or do any other comparisons between the two children. You have to give different names to the variables for the older child, as I show for the b variables. Let me know if you have questions.

* How to put the next older child (if any) onto a child's record
* Strategy: construct a variable "pair" that has the same value for the younger and older child;
*   save one copy of the file for the younger child and another copy for the older child and then merge.

set more off
* specify a folder for temporary files
cd e:\DHS\DHS_data\scratch

* open a BR file; could also do with a KR file
use e:\DHS\DHS_data\BR_files\MWBR61FL.dta
keep v001 v002 v003 b*

* bidx=1 for the youngest child

gen pair=bidx
sort v001 v002 v003 pair
save temp.dta, replace

drop if bidx==1
gen pair=bidx-1
rename b* older_b*
sort v001 v002 v003 pair

merge v001 v002 v003 pair using temp.dta

* check by testing whether the birth interval matches with b11 for the younger child and b12 for the older child

gen interval=b3-older_b3
correlate interval b11 if interval>0
correlate interval older_b12 if interval>0
Previous Topic: svy command and descriptives
Next Topic: Merging HR variables with KR file
Goto Forum:
  


Current Time: Wed Jun 23 14:18:21 Coordinated Universal Time 2021