Statalist The Stata Listserver

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

RE: st: list subjects with a similar value

From   "Nick Cox" <>
To   <>
Subject   RE: st: list subjects with a similar value
Date   Wed, 22 Mar 2006 22:36:16 -0000

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 

> 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:

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