Monday, February 27, 2006
Re: st: Question about duplicates and tag command
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: Richard.A.Williams.5@ND.Edu 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/
Links to this post: