I am working with dates of birth of children before the mothers are diagnosed with a disease. In a wide format each consecutive birthdate are numberad parity1 to parityx. I use inrange to identify the number of births before the diagnosis
unab Pari: Parity*
local N: word count `Pari'
gen Parity_at_baseline=0
forv i=1/`N'{
replace Parity_at_baseline=Parity`i' if inrange(birthdate`i',0,dateofdiagnosis)==1
}
This does not work for dates before 1960. I think -1<0<1 is logically right but not according to inrange. dis inrange(-1,0,1) gives 0
How can I solve this.
Related Posts with dis inrange(-1,0,1) gives 0 but should give 1
Assigning labels as variable valuesI am using encode to convert a variable from string to numeric type so that I can use it in a regres…
how to count the number of variables after split?Dear All, How to generate a new variable that equals the number of variables generated after split?…
logistic regression standard errorsHi All, When I run the logit command I get the following result outcome | Coef. Std. Err. z P>|…
plotting means + cis using imputed data and coefplotHi everyone, I hope you'll be able to help me with this question. I have multiple years of cross-se…
Calculating birthdate from age and age at test dateHow do I calculate birthdate from the age at test date (ageIGA) and the test date (tvdIGA)? Variabl…
Subscribe to:
Post Comments (Atom)
0 Response to dis inrange(-1,0,1) gives 0 but should give 1
Post a Comment