Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: selecting cases bordering sampled cases
From
Viktor Emonds <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: selecting cases bordering sampled cases
Date
Fri, 25 Nov 2011 16:27:34 +0100
Hello,
I have used several sample frames to select schools for my research and I'd like to select replacement schools to be prepared for non-reponse on the school level. I used serpentine sorting on implicit stratification variables within each frame, so the cases (i.e. schools) right before and after the sampled cases should be similar on core characteristics.
How can I best write syntax that selects these replacement schools? Say I have 15 sampled schools, identifiable by win1 (win2, win3 etc.=1). I would like to do the following:
1. Ascertain that the case before the sampled case is not already sampled as well
2. Assign this case value 1 on a new variable firstreplac`i' with i corresponding to the 15 sampled schools
3. If the previous case is already sampled, go 1 case back and repeat procedure until a non-sampled school is found
4. Ascertain that the case after the sampled case is not already sampled
5. Assign this case value 1 on a new variable secondreplac`i'
6. If the next case is already sampled, go forward 1 case and repeat procedure until a non-sampled school is found
Any ideas and help would be much appreciated.
Best,
Viktor
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/