Statalist


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

Re: st: Sorting data puzzles


From   "Austin Nichols" <[email protected]>
To   [email protected]
Subject   Re: st: Sorting data puzzles
Date   Sat, 26 Jan 2008 07:01:30 -0500

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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index