Thanks to Kit Baum, a -fixsort- package has been
added to SSC. Stata 9 is required.
Florence Neymotin posted a question on 28 June on
sorting and in response I posted a program -cosort-,
previously posted on the list at least once but never
archived anywhere.
After some thought -- and indeed wanting this
recently for my own purposes -- I have produced
a new program -fixsort- with similar but not identical
aims. The help file gives some detailed explanations
and examples, including some warnings.
-fixsort- sorts each variable specified and places
variables so that all are in sorted order, aligned so
that the first value of each is in the first observation,
the second value of each is in the second observation,
and so on. By default the variables so placed are the
variables specified; with the -generate()- option they
are new variables containing copies of those variables.
Other variables retain their current sort order.
Variables may be numeric or string.
Note that -fixsort- is a rarely needed command. Almost
all sorting problems call for -sort- or -gsort-. Also,
-fixsort- destroys information in your data set in so far
as values in each observation are typically not kept together.
Nick
[email protected]
*
* 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/