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]

RE: st: serpentine sorting


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: serpentine sorting
Date   Wed, 12 Oct 2011 19:23:47 +0100

It's part of official Stata too. 

Nick 
n.j.cox@durham.ac.uk 

Steven Samuels

Check out the -fill- -egen- command by R. Mark Esman. 

net describe dm55, from(http://www.stata.com/stb/stb43)

On Oct 11, 2011, at 7:36 AM, Viktor Emonds wrote:

I am working on the construction of proper sampling frames for a research on the learning trajectories of minority and majority children in schools in Flanders. The target group are 3rd year students and we will select school establishments to conduct our study. 

Core variables of interest are the proportion of minority students in the 3rd year within an establishment (pforeign3), an implicit stratifier for educational tracks (typestrat), number of students (in quartiles) in the 3rd year in an establishment (studstrat), an implicit school net stratifier, an implicit dummy stratifier for high.low proportion of Turks in the region and a 4-category explicit stratifier on proportion of minority students in year 3 in the establishments (based on pforeignj3).

The idea is to create 4 sampling frames, one for each value of the explicit stratifier, and within each frame, sort on the implicit stratifiers (so we get nested sorting). At the lowest nesting level (in this case student size), we want to use the serpentine method and sort pforeignj3 ascending and descending in an alternating way over the values of studstrat. Unfortunately, gsort does not allow if commands, so something like gsort with - and + on even or odd values of studstrat doesn't work.

I tried sorting everything separately for each ethstrat-studstrat combination and then appending per ethnic stratum, but obviously, it doesn't work, because the nested sorting of the implciit stratifiers is disrupted and studstrat efefctively becomes a top-level stratifier. Any ideas on how to solve this? Thanks in advance!


*
*   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