Thanks martin for the tip and references. Although mechnical your
solution works perfectly.
2009/12/21 Martin Weiss <[email protected]>:
>
> <>
>
> BTW, before you get into this exercise, familiarize yourself with the
> hazards of -sort-, as documented in
> http://www.stata-journal.com/sjpdf.html?articlenum=dm0019 and
> http://www.stata.com/support/faqs/lang/sort.html
>
>
>
>
> HTH
> Martin
>
>
> -----Ursprüngliche Nachricht-----
> Von: [email protected]
> [mailto:[email protected]] Im Auftrag von Abdel Rahmen El
> Lahga
> Gesendet: Montag, 21. Dezember 2009 00:34
> An: [email protected]
> Betreff: 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/
>
--
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/