Statalist The Stata Listserver


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

RE: RE: st: RE: RE: Encryption of data


From   "Hendri Adriaens" <[email protected]>
To   <[email protected]>
Subject   RE: RE: st: RE: RE: Encryption of data
Date   Fri, 15 Jun 2007 12:48:52 +0200

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/



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