Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Generating an ID


From   "Michael I. Lichter" <[email protected]>
To   [email protected]
Subject   Re: st: Generating an ID
Date   Fri, 10 Oct 2008 13:39:14 -0400

Maria,

It's not clear what you're after. If the twins share one record between them, why would any searching be necessary? Why would separate IDs be necessary or even helpful?

If each twin has a separate record but they share the same TwinID, you could do something like this:

	by TwinID time-of-birth, sort: gen ID = (TwinID * 10) + _n

If a pair has TwinID 205, the older twin would be ID=2051 and the younger would be ID=2052. (Of course, you don't need to sort on anything other than TwinID, and the internal ordering of the twins could be arbitrary.) Is that what you want?

Michael

Maria Garden wrote:
Dear Stata list,

I have the following problem: I have data where people had been asked
to provide their name and the name of their twin.

I would like to generate an identifier for each twin pair. How can I
do that without really search for each name? I have a couple of
hundred people.

My data looks like this:

name / Twin name / TwinID
Helena Harris / Joanne Moore / 1
Kevin Dedman / Tom Dedman / 2
Freya Lamb / Sandra Scott / 3

Sandra Scott / Freya Lamb / 3
Tom Dedman / Kevin Dedman / 2
Joanne Moore / Helena Harris / 1

How can I generate the variable TwinID? Can anyone help?

Thank you very much.

Maria
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

--
Michael I. Lichter, Ph.D.
Research Assistant Professor & NRSA Fellow
UB Department of Family Medicine / Primary Care Research Institute
UB Clinical Center, 462 Grider Street, Buffalo, NY 14215
Office: CC 125 / Phone: 716-898-4751 / E-Mail: [email protected]
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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