Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Macro syntax help


From   Meryle Weinstein <[email protected]>
To   [email protected]
Subject   st: Macro syntax help
Date   Sun, 05 Feb 2006 12:45:39 -0500

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'
}

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index