Statalist


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

st: RE: sort by permutation


From   "Tharyan, Rajesh" <R.Tharyan@exeter.ac.uk>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: sort by permutation
Date   Mon, 21 Dec 2009 08:52:55 +0000

Hi,

Sorting in stata is as easy as 

 sort g1 g2 g3 g4 or sort g1 g3 g2 g4 etc.

For more type -   h sort 

Regards
rajesh 

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Abdel Rahmen El Lahga
Sent: 20 December 2009 23:34
To: statalist@hsphsun2.harvard.edu
Subject: st: sort by permutation

I have a sample of N individuals belonging to 4 sub-groups g1, g2, g3,
g4. I would like to sort my sample of size N  in 24 different
manners, corresponding to all possible permutations of my group
variable
say, {g1,g2,g3,g4}, {g1,g3,g2,g4} {g1,g3,g4,g2}...etc.
Taking a simple exemple for N=10. I have
id group
1    1
2    1
3    2
4    2
5    2
6    3
7    3
8    4
9    4
10  4

one possible sorting among 24 could be
id group
1    1
2    1
6    3
7    3
3    2
4    2
5    2
8    4
9    4
10  4
any help is apreciated
-- 
AbdelRahmen El Lahga
*
*   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/

*
*   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   |   What's new   |   Site index