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

st: help creating a unique identifier


From   "Joao Pedro Wagner de Azevedo" <jazevedo@provide.com.br>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: help creating a unique identifier
Date   Thu, 17 Mar 2005 13:42:51 -0300

Hello,

I have a dataset with the variable id_dom (numeric) which s a unique
identifier of households and the variable age (see extract below). I would
like to create a couple of new variable and I would sincerely appreciate if
anyone on the list give me a hand.

First, I would like to create a sequential unique identifier such as
variable SeqID. Second, I would like to create a variable which would flag
all those households with at least on adult (age>=15).

Initially I would like to avoid having to use collapse and merge (given the
size of my dataset), and I have been trying to use command such as bysort,
_n and _N.

Any help will be much appreciated.

Cheers,

JP


id_dom		age	SeqID
9211001200001	5	1
9211001200001	10	1
9211001200001	15	1
9211001200001	20	1
9211001200001	25	1
9211001200002	5	2
9211001200002	10	2
9211001200002	15	2
9211001200002	20	2
9211001200002	25	2
9211001200003	4	3
9211001200003	8	3
9211001200003	12	3
9211001200003	16	3
9211002100002	3	4
9211002100002	6	4
9211002100002	9	4
9211002500004	7	5
9211002500004	14	5
9211002500004	21	5
9211002500004	28	5
9211002500004	35	5
9211002500004	42	5
9211002500004	49	5

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