Re: chap 9 reproductive health [message #25401 is a reply to message #25369] |
Fri, 14 October 2022 16:30 |
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
}
|
|
|