Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Eric Booth <ebooth@ppri.tamu.edu> |
To | "<statalist@hsphsun2.harvard.edu>" <statalist@hsphsun2.harvard.edu> |
Subject | Re: st: longitudinal data |
Date | Sun, 5 Jun 2011 02:42:48 +0000 |
<> bys visit: egen everdead = max(died) - Eric __ Eric A. Booth Public Policy Research Institute Texas A&M University ebooth@ppri.tamu.edu On Jun 4, 2011, at 9:21 PM, Tina Hernandez-Boussard wrote: > Hi All, > > 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. > > Any help??? > > > Cheers, > > Tina > * > * 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/ * * 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/