Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

Re: st: longitudinal data

From   Nick Cox <>
Subject   Re: st: longitudinal data
Date   Sun, 5 Jun 2011 07:22:36 +0100

Other ways to do it, assuming no missings on -died- :

bysort visit (died) : gen dead = died[_N]

bysort visit (time) : gen dead = died[_N]


On Sun, Jun 5, 2011 at 3:42 AM, Eric Booth <> wrote:

> bys visit: egen everdead = max(died)

Tina Hernandez-Boussard wrote:

>> I have longitudinal data and I would like to flag a person as dead, =
>> although this information is only contained in their last observation
>> I have created a count of the number of observations for a unique id
>> by visit: gen time =3D _n
>> this is what I am trying, but I am not getting correct results:
>> by visit : gen dead =3D 1 if died =3D=3D 1
>> I would like to have the flag dead=3D1 for all the rows of data for this =
>> person, even though they do not die until _n =3D=3D 5
>> This is only capture the visit they died, and not all of their visits.
*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index