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
Unequal number of observations in percentile groupsHi Stata users, I am trying to come up with percentile groups using the code below Code: _pctile …
How to change scientific notation into standard format?Hello all, can anyone please guide me, how can I get rid of scientific notation in the summary down …
Regress for each company by using "foreach" or "forvalues" commandHi there, My panel data set includes 389 companies and 51 quarter years. I am trying to regress my …
Generate grouping variable based on various nominal variablesDear community, I'm working with household data containing various nominal or ordinal variables suc…
areg in cross-sectional data and multicollinearity Hello, I have a cross sectional data consisting of 632 banks in 67 countries. In my dataset I have …
Subscribe to:
Post Comments (Atom)
0 Response to dis inrange(-1,0,1) gives 0 but should give 1
Post a Comment