Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: -matvsort- revised on SSC


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: -matvsort- revised on SSC
Date   Fri, 19 Dec 2003 19:26:43 -0000

Thanks to Kit Baum, the package -matvsort- has been 
revised on SSC. 

-matvsort- was published in STB-56. It sorts 
a row or column vector into numeric order. 
-matvsort- has been updated to Stata 8. 
In particular, it now longer changes the 
sort order of the data. The previous version 
remains in the package as -matvsort6- for 
users of Stata 6 or 7. 

I would not have updated this program without 
a problem posed by Walter Forrest, which 
has led to two additional programs being 
added to the package. 

-matrsort- sorts the rows of a matrix into 
numeric order.

-matcsort- sorts the columns of a matrix into 
numeric order.

Both require Stata 8. 

You may well wonder whether -matvsort- (for 
a vector) is now needed, given the more general 
programs to sort matrices. However, if 
we sort a vector, it always makes sense 
to sort the row or column names at the same 
time. So 

pi     3.14159
e      2.71828
gamma  0.57722 

can clearly be sorted to 

gamma  0.57722 
e      2.71828
pi     3.14159

However, if each row or column of a matrix 
with more than one row and more than one 
column is sorted, in general names 
must be abandoned. 

There remains the valid problem of sorting 
a matrix's rows or columns according
to the values in _one_ specified row or 
column, not tackled here. 

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




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



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