Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: bug in Stata's sorted-by flag


From   "William Gould, StataCorp LP" <[email protected]>
To   [email protected]
Subject   Re: st: bug in Stata's sorted-by flag
Date   Thu, 15 Aug 2013 10:30:14 -0500

Sergiy Radyakin <[email protected]> reports, 

> it seems that under some conditions Stata 9.2-12.1 (Windows)
> incorrectly reports that the dataset is sorted while in fact it is
> not.

Sergiy reports that this happens when 

        1.  The data are sorted by a variable or variables, say myvar.

        2.  One or move observations of myvar contain EXTENDED missing
            values (.a, .b, ..., .z).

        3.  -set obs- is used to add extra observations to the end 
            of the dataset. 

The data are fine, but -describe- will report that the data are sorted
by myvar, which is not true because, . < .a < .b < ... < .z. 

In most cases the bug has no implications beyond the mistaken
-describe-, which is why it's gone undiscovered for 8+ years.

We will fix it. 

In the meantime, the workaround is to -sort- the data after -set obs-.
You must sort on an extraneous variable, 

           . set obs ...
           . sort a 
           . sort myvar

You might worry that, because the internal sort marker is incorrect,
lots of other problems could arise.  In general, that would be true.
In this case, however, such problems do not arise because all the
misordering occurs within missing values.


-- Bill
[email protected]
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index