The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Countries » Nigeria » chap 9 reproductive health (generate age and period )
Re: chap 9 reproductive health [message #25401 is a reply to message #25369] Fri, 14 October 2022 16:30 Go to previous message
Janet-DHS is currently offline  Janet-DHS
Messages: 888
Registered: April 2022
Senior Member
Following is a response from DHS staff member Tom Pullum:

There are various ways to do this. Here is one that has minimal modification of your code:

scalar b19_included=1

capture confirm numeric variable b19_01, exact
if _rc>0 {
* b19 is not present
gen age = v008 - b3_01
scalar b19_included=0
}

if _rc==0 {
* b19 is present
gen age=b19_01

* Check values of b19
summarize b19_01
if r(sd)==0 | r(sd)==. {
replace age = v008 - b3_01
scalar b19_included=0
}

 
Read Message
Read Message
Previous Topic: sanitation service
Next Topic: chap 11(Nutrition indicator)
Goto Forum:
  


Current Time: Tue Nov 26 04:02:02 Coordinated Universal Time 2024