[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: help creating a unique identifier
At 1:42 PM -0300 3/17/05, Joao Pedro Wagner de Azevedo wrote:
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).
egen SeqID = group(id_dom)
bys id_dom: egen agegt15 = max(15<=age)
The first command will generate consecutive integers, one for each
value of id_dom (according to the sort order of id_dom). The second
will create a 0/1 variable constant within id_dom, where a one
indicates that there is at least one observation with age >= 15.
* For searches and help try: