Wednesday, March 22, 2006

RE: st: list subjects with a similar value

You are avoiding the command -duplicates- and doing it from first principles. That is a very good idea. -duplicates- is just a wrapper for stuff like this.

But the three steps here can be cut to two.

bysort date_of_birth : gen dob_duplicate = _N list id date_of_birth if dob_duplicate >= 2

Nick n.j.cox@durham.ac.uk

clinton.thompson@summitllc.us > there may be a more elegant way to do this, albeit this is > but one attempt: > > * obtain the number of duplicates w/in date of birth > bysort date_of_birth: gen dob_duplicate = _N > * tag each combination of DOB & the duplicates therein > egen dob_tag = tag(date_of_birth dob_duplicate) > * list the ID & DOB associated w/ each repeated DOB... > list id date_of_birth dob_tag if dob_tag > > I have a large database and would like to list the idnumber of all > > subjects with the same date of birth. How do I do this? I have tried > > .duplicate, but can figure out how to do it. Thanks.

* * 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/


Tag:


Links to this post:

Create a Link



<< Home

This page is powered by Blogger. Isn't yours?