Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Nick Cox <njcoxstata@gmail.com> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | Re: st: Macro Producing Different Results Each Time Executed |
Date | Thu, 22 Aug 2013 22:02:41 +0100 |
Phil is right here. Nick njcoxstata@gmail.com On 22 August 2013 22:00, Phil Schumm <pschumm@uchicago.edu> wrote: > On Aug 22, 2013, at 3:57 PM, Phil Schumm <pschumm@uchicago.edu> 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/ * * 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/