Statalist


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

RE: st: Re: I did it! sorting with a key


From   "Shahrul Mt-Isa" <shahrul_mtisa@hotmail.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Re: I did it! sorting with a key
Date   Fri, 12 Sep 2008 17:05:54 +0100

Thanks Sergiy and Ashim. That sounds better now as what I thought before it
would just mess up the data.



-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Ashim Kapoor
Sent: 12 September 2008 16:54
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: Re: I did it! sorting with a key

Hi!

I want for each observation i , ai's sorted according to ki's.

So a1 a2 k1 k2
      1  2   -1 -2

If I do sortrows a1 a2 --> I would get a1 a2
                                                      1  2

If I do sortrows k1 k2 ->> I get k1 k2
                                             -2 -1

but what I want is a1 a2 k1 k2
                             2 1  -2 -1
This is what the new program does.
Ummmm do I make it clear now ? Please email me again if you don't get me.

Thank you,
Ashim.


On Fri, Sep 12, 2008 at 9:05 PM, Shahrul Mt-Isa <s.h.mtisa@qmul.ac.uk>
wrote:
> Hi (Ashim particularly),
>
> This thread seems very interesting and generated a lot of interests. Just
> one comment though: what is your program -keysortrows- trying to achieve?
> From my understanding it does nothing more than running -sortrows- of
> Jeffrey Arnold repeatedly for the variables in question.
>
> For example,
>
> a1      a2      key1    key2
> 2       1       4       2
> 3       4       6       4
> 7       5       8       1
>
> You wanted if key1<key2 then a1<a2.
>
> Then do -sortrows key1 key2- followed by -sortrows a1 a2-
>
> Isn't this what you are trying to achieve?
>
> a1      a2      key1    key2
> 1       2       2       4
> 3       4       4       6
> 5       7       1       8
>
> If it is, I'm sorry to spoil all the fun!
>
>
> BW,
> S Mt-Isa
>
>
> *
> *   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/

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