Statalist The Stata Listserver


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

Re: st: Question about duplicates and tag command


From   Richard Williams <[email protected]>
To   [email protected], <[email protected]>
Subject   Re: st: Question about duplicates and tag command
Date   Mon, 27 Feb 2006 05:46:34 -0500

At 04:48 AM 2/27/2006, Mosca, Ilaria wrote:
Dear Statalisters,

I have been working with a database in which I had to identify
duplicates of institutions and afterwards count the number of
institutions per year. I therefore wrote the following commands:

. sort code
. quietly by code: gen dup=cond(_N==1,0,_n)
. drop if dup>1
. gen id04==1 if year==2004
. count if id04==1

My problem is that EVERY TIME that I was running these commands, I
obtained different results! Once the count command was 749, once 753,
and so on. And this without any apparent reason.
See -help sort- and the -stable- option. Sort orders can be different each time you run the -sort- command unless you use the -stable- option.


-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
FAX: (574)288-4373
HOME: (574)289-5227
EMAIL: [email protected]
WWW (personal): http://www.nd.edu/~rwilliam
WWW (department): http://www.nd.edu/~soc
*
* 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