Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Sort values in rows


From   "Sebastian F. Büchte" <sfbuechte@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Sort values in rows
Date   Wed, 7 Feb 2007 15:34:42 +0100

Nikos,

there exists a user written command called -sortrows- (it requires
Stata 9 or better). Assuming that you have access to the web from
within Stata you can download it from ssc by typing -ssc install
sortrows- in your Stata command window. Usage of sortrows is
documented in -help sortrows-. For your problem it could be used inthe
following way: -sortrows v1 v2 v3 v4 v5, replace-

Sebastian



On 2/7/07, Nikolaos A. Patsopoulos <npatsop@cc.uoi.gr> wrote:
Hi all,

I have a large dataset with 5 variables that contains number in random
order:
v1 v2 v3 v4 v5
28    1    25    22    14
23    2    3    34    39
6    16    8    24    19
3    45    8    1    37
4    23    27    33    10
16    41    33    13    21
...................................
................................



I want to sort them in such a way that the v1[i]<v2[i]<v3[i]<v4[i]<v5[i]
for each i:

1 14 22 25 28
2 3 23 34 39
......
......
..


Any ideas?

Thanks in advance,

Nikos



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

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