|
Re: I need help constructing a variable in Stata [message #75 is a reply to message #74] |
Wed, 20 February 2013 11:56 ![Go to previous message Go to previous message](/theme/default/images/up.png) ![Go to next message Go to next message](/theme/default/images/down.png) |
Bridgette-DHS
Messages: 3151 Registered: February 2013
|
Senior Member |
|
|
Here is a response from one of our STATA experts Tom Pullum that should answer your question.
Go to the IR (women's) file, GHIR4BDT.DTA. Use the following variables:
The woman's cmc (century month code) of birth is v011
The child's cmc of birth is b3
The birth order is given by bord. For the second birth, the cmc of birth is b3_02
Define a new variable, which I will call mageb02, the mother's age at the birth of the second child, with
gen mageb02=int((b3_02-v011)/12)
In Stata, this will be coded "missing" (.) if there was no second birth. The int command gives the integer part of any number.
The only possible issue arises when the mother and child are both born in the same calendar month. My formula would say that if, for example, the mother was born in March 1980 and the child was born in March 2000, then the mother was 20 years old at the time of the birth. However, it is possible that the mother was born on March 20, say, and the child was born on March 10, so that the mother was actually only 19 at the time of the birth (and turned 20 ten days after the birth). This is the sort of issue that gives demographers gray hair. The usual way to resolve it would be to say that all births, for the mother and her children, occur on the same day of the month (the 15th, for example). Then the child would have been born right on the mother's 20th birthday and the formula would be ok.
I suggest that if you are comparing with something given in the final report, you try to replicate with this formula. You will need to use weights (v005) for any means or tabulations, etc.
I hope this helps.
Bridgette-DHS
[Updated on: Mon, 18 March 2013 08:18] Report message to a moderator
|
|
|
|
Re: I need help constructing a variable in Stata [message #13091 is a reply to message #13066] |
Mon, 18 September 2017 10:05 ![Go to previous message Go to previous message](/theme/default/images/up.png) |
Bridgette-DHS
Messages: 3151 Registered: February 2013
|
Senior Member |
|
|
Here is another response from DHS Stata Expert, Tom Pullum:
The following Stata lines should accomplish what you want, with the births re-sequenced by birth order rather than by recency.
quietly summarize v201
scalar max_ceb=r(max)
keep v011 b3* bord*
rename b*_0* b*_*
* bord_1 is the birth order of the most recent birth
* the first birth will be the one for which bord_1=1 or bord_2=1 or bord3=1, etc
* the second birth will be the one for which bord_1=2 or bord_2=2 or bord3=2, etc
local lj=1
quietly while `lj'<=max_ceb {
gen b3ordered_`lj'=.
local li=1
while `li'<=max_ceb {
replace b3ordered_`lj'=b3_`li' if bord_`li'==`lj'
local li=`li'+1
}
local lj=`lj'+1
}
summarize b3_*
summarize b3ordered_*
|
|
|