Hi Maarten, William,
> The reason is that Bill created newid as follows:
> gen double random = uniform()
> sort random
> gen long newid = _n
>
> So, the random draws created by uniform() are
> used to order the data, and than the newid is
> assigned the current observation number, i.e. the
> first observation is given a 1, the second a 2,
> the third a 3, etc. Hence it is impossible to get
> ties. Nick pointed out that there is a very small
> but nonzero probability that the function uniform()
> creates ties, but that is in this case irrelevant
> because in those cases the ties are ordered
> randomly, so both will get a distinct value on
> newid.
Yes, indeed. I overlooked the newid generation and was still thinking that
the random numbers were the new keys, sorry about that. Indeed, this is a
solution without ties, thanks a lot.
And thanks for the example.
Best regards,
-Hendri.
*
* 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/