Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: selecting cases bordering sampled cases


From   Viktor Emonds <Viktor.Emonds@soc.kuleuven.be>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index