The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Child Health » How to generate Month-Year birth Cohort (Generating new variables )
How to generate Month-Year birth Cohort [message #29248] Tue, 14 May 2024 20:48 Go to next message
Atazonomics is currently offline  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 #29263 is a reply to message #29248] Thu, 16 May 2024 09:43 Go to previous messageGo to next message
Janet-DHS is currently offline  Janet-DHS
Messages: 893
Registered: April 2022
Senior Member
Following is a response from DHS staff member, Tom Pullum:

Because you want birth cohorts of children, rather than mothers, it will be easier to use the BR file. It has one record for each birth in the birth histories, whether or not the child survived, so b1 and b2 are always coded and you don't need to use "capture confirm". Single-year (calendar year) birth cohorts are given by b2.

Note that in many surveys conducted before 2000, if you are going back that far, years may be given with just the last two digits--for example, "92" instead of "1992".
Re: How to generate Month-Year birth Cohort [message #29265 is a reply to message #29263] Thu, 16 May 2024 10:01 Go to previous messageGo to next message
Atazonomics is currently offline  Atazonomics
Messages: 4
Registered: April 2024
Member
Thank you very much for the repply. I also need some information such as mother height, age, years of education; age and education head of household, wealth index from the IR file. By your answer, do you suggest I merged the BR with the IR? If so, what is the best way to merge 1:m using "BR" or m:1 using "IR"?

Do you also suggest I use that to calculate 'None of the basic vaccinations' and 'all of the basic vaccinations' if I want to construct variable for kids that received none of the eight basic "None of the basic vaccinations" and received "All basic vaccinations" : "bcg" "polio1" "polio2" "polio3" "measles" "dpt1" "dpt2" "dpt3"
If so, what would be the appropriate command ?
Re: How to generate Month-Year birth Cohort [message #29395 is a reply to message #29265] Tue, 11 June 2024 15:46 Go to previous message
Janet-DHS is currently offline  Janet-DHS
Messages: 893
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)
Previous Topic: still birth
Next Topic: Early childhood development
Goto Forum:
  


Current Time: Mon Dec 2 15:05:07 Coordinated Universal Time 2024