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: Macro Producing Different Results Each Time Executed
From
Phil Schumm <[email protected]>
To
[email protected]
Subject
Re: st: Macro Producing Different Results Each Time Executed
Date
Thu, 22 Aug 2013 16:00:59 -0500
On Aug 22, 2013, at 3:57 PM, Phil Schumm <[email protected]> wrote:
> That's likely the best guess, looking at your code. Remember, -sort- is (by default) not stable, and one of the reasons for this is exactly so that problems like this are discoverable. In the future, whenever you are doing something that is dependent on the sort order of the data, use
>
> isid <varlist>, sort
>
> instead of -sort- to ensure that the order of the dataset is uniquely determined.
I see that a few folks have suggested using the -stable- option for sort, but note that that will simply mask the problem instead of solving it.
-- Phil
*
* 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/