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
Creating a table using stored values from xtsumDear all, I would like to create a table automatically using stored values. I run a command Code:…
ROC ComparisonHello All, I am trying to do a ROC Curve Comparison looking at three different models in the same d…
Hausman test for multilevel modelI want to make a Hausman test, to test wether my mixed effects model is different from a fixed effec…
Create preference order for source of dataHello everyone, I have occupational data for a large set of countries over time that come from diff…
try to do a loop within a loopI am a beginner stata user and new to this post. I found this forum was extremely helpful when I goo…
Subscribe to:
Post Comments (Atom)
0 Response to dis inrange(-1,0,1) gives 0 but should give 1
Post a Comment