Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: create unique variables


From   "David Harrison" <David@icnarc.org>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: create unique variables
Date   Fri, 4 Feb 2005 11:07:05 -0000

While both of the suggestions so far work fine, what is wrong with just:

egen id=group(firstname lastname dob)

David
david@icnarc.org

-----Original Message-----
From: Fouarge.j. [mailto:D.J.Fouarge@uvt.nl]
Sent: 04 February 2005 10:58
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: create unique variables


you could try this (assuming var a = last name, b = first name, ...):
sort a b c 
gen tel=_n
by a b c: egen pid=min(tel)
drop tel

didier


-----Original Message-----
From: "Paolo Grillo, MD" <paolo.grillo@guest.unimi.it>
To: statalist@hsphsun2.harvard.edu
Date: Fri, 04 Feb 2005 10:13:10 +0100
Subject: st: create unique variables

I have a dataset with the following variables:

last name
first name
date of birth

Since this dataset contains more than one record for individual, I would 
create a  unique variable for subject (ID).
Could anyone help me in this problem?
Thank in advance

-- 



* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 

Paolo Grillo MD
Nephrologist 
Statisticians
EPOCA Research Center for Occupational, Clinical & Environmental Epidemiology
Department of Occupational and Environmental Health "Clinica L. Devoto"
University of Milan
Via San Barnaba 8
20122 Milano - ITALY
Tel: +39 02 503-20148
Fax: +39 02 503-20126
E-Mail paolo.grillo@guest.unimi.it



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




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


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index