[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
[no subject]
Also, Stata remembers only one sorting order, so if I sort by x, and
then clonevar p=x, then the dataset is not sorted by p (though
renaming a variable is OK with respect to sorting). In general this
does not matter, but when the key is assigned to the data which is
already sorted, then I would want to let Stata know, that there are
two concurrent sortings present, example:
given a sorted list of states AA...WY a numerical code is assigned to
each. Hence the dataset is sorted by two variables concurrently,
rather then by first variable, then by second within groups defined by
the first one.
Thank you,
Sergiy
On 1/26/08, Austin Nichols <[email protected]> wrote:
> Sergiy--
> You are testing -gsort- (commonly known to be inefficient), not
> -sort-. Try this kind of comparison instead:
>
> set mem 600m
> set obs 1000000
> gen x=uniform()
> set rmsg on
> sum x
> *Initial Sort - Data Was In Random Order
> sort x
> *Repeated Sort - Data Is In Opposite Order
> g _x=-x
> sort _x
> gsort -x
> *Repeated Sort - Data Is In Opposite Order
> sort x
> *Testing Intelligence
> sort _x
> sort _x
> sort x
> sort x
>
> On Jan 25, 2008 11:09 PM, Sergiy Radyakin <[email protected]> wrote:
> > Here are two quotes from the Manual for Stata 9:
> > 1) "Stata keeps track of the order of your data" [D] sort, p441
> > 2) "It [Stata] sorts already-sorted datasets instantly, so Stata's
> > ignorance costs us little".
> > I wonder if Stata is actually making any use of this knowledge
> *
> * 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–2024 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |