How to generate Month-Year birth Cohort [message #29248] |
Tue, 14 May 2024 20:48 |
Atazonomics
Messages: 4 Registered: April 2024
|
Member |
|
|
I working on research and I need to group children into month-year cohorts from the IR files of Uganda, Ivory Coast and Nigeria. In the survey rounds 6 or lower, I use the moth of birth and year of birth and use group (b1 b2)and for 7 or 8 wave, i used the following :
* Loop through each child's month and year of birth variables
foreach i of numlist 1/20 {
* Check existence of the month variable
capture confirm variable b1_`i'
if _rc != 0 {
display "Month variable b1_`i' not found. Skipping to next."
continue
}
* Check existence of the year variable
capture confirm variable b2_`i'
if _rc != 0 {
display "Year variable b2_`i' not found. Skipping to next."
continue
}
* Only proceed if both variables are present and not missing
if !missing(b1_`i', b2_`i') {
* Convert month and year to strings with proper formatting
local str_month_`i' = string(b1_`i', "%02.0f")
local str_year_`i' = string(b2_`i')
* Concatenate year and month into a cohort variable
gen cohort_`i' = str_year_`i' + "-" + str_month_`i'
} else {
* Explicitly set cohort to missing if either month or year is missing
gen cohort_`i' = "."
}
}
Both methods did not work .
Please, i look forward to your help as this is holding me up
Thank you
|
|
|
|
|
Re: How to generate Month-Year birth Cohort [message #29395 is a reply to message #29265] |
Tue, 11 June 2024 15:46 |
Janet-DHS
Messages: 888 Registered: April 2022
|
Senior Member |
|
|
Following is a response from DHS staff member, Tom Pullum:
We apologize for the delay in this response. You may no longer have a question.
Most of the IR variables are copied onto the BR file. That is, most of the mother's characteristics are attached to the child's characteristics. Look for the variables you need in the BR file. If you still need to know how to merge additional IR variables into the BR please let us know.
If you are working with just children under 5, then you would use the KR file and what I said above about the BR file would apply to the KR file. The KR file is a subset of the BR file, for children born in the past 5 years.
Each child's immunization data is on the record in the KR file. You can look up the names of the variables and construct the indicators that appear in the final report. All of the recodes are on our GitHub site (https://github.com/DHSProgram/DHS-Indicators-Stata)
|
|
|