Dear all
Im having a little trouble with forval. I would like to
1. Use a master data set
2. Keep observations that fall within a given range of a variable of
values and save that as a data set
3. Draw a sample from this smaller data set and then do a few more
things
4. Change the range in 2
5. Repeat 3
here is a really short version of what I have written
forval i = 5000(5000)20000 {
forval j = 5(5)15 {
u masterdata, clear
keep if dfor < `i'
save buffer_`i', replace
local expl_vbls "bla bla bla"
//some more stuff
u buffer_`i', clear
spatsam, g(`j') x(x) y(y) norest saving(b`i'_space`j')
replace //draw a subsample
logit def `expl_vbls'
//some more stuff
}
}
Im not sure this is doing what I want it to do. Essentially I would
like to implement the first loop
keep if dfor<`i'< 5000
and then on this portion of the data
implement the second loop forval j = 5(5)15
and then go back to the outer loop and increase the value of `i' and go
over this again.
Kindly advise on how I can proceed with this
Ronnie
*
* 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/