I'm using the following syntax to run a regression analysis on a
subset of cases that fall within a range of values (above/below the
cutoff). For some reason it's running the analysis on a random
selection of cases that fall all over the place -- some are within the
range, while others are way out of the range. Any help in finding a
bug in the program is appreciated.
Meryle Weinstein
Research Scientist
Institute for Education and Social Policy
New York University
gen below = .
gen above = .
gen observ = .
gen window = .
gen treatfx_m4_2 = .
gen se_m4_2 = .
gen diff_m4_2 = .
local counter = 0
forvalues temp=0.25(0.05)10 {
replace below = cutoff - `temp'
replace above = cutoff + `temp'
local counter = `counter' + 1
regress p34mg4 ppov bor1t1 if ppov > below & ppov < above
replace diff_m4_2 = _b[bor1t1] in `counter'
regress p34mg4 ppov bor1t1 if ppov > below & ppov < above
replace treatfx_m4_2 = _b[bor1t1] in `counter'
replace se_m4_2 = _se[bor1t1] in `counter'
gen indic = 1 if ppov > below & ppov < above
egen blah = sum(indic)
replace observ = blah in `counter'
drop blah indic
replace window = `temp' in `counter'
}