[EpiData-list] first observation among several for each person (no subject)

epidata-list at lists.umanitoba.ca epidata-list at lists.umanitoba.ca
Mon Sep 29 10:26:53 CDT 2014


In analysis just do this:
read "your datafile name"
sort idunique visitdate
gen i number = 1
if idunique = idunique[_n-1] then number = number[_n-1] + 1

* now you have a variable "number", which gives the sequence of observations for each person.

select number = 1
* will now make sure you only analyse the first observation.

You may also use the commands aggregate, but there would be a problem (as I remember it) with dates, which are then just integers and no longer dates.

regards
Jens Lauritsen
EpiData Association



Den 29. sep. 2014, epidata-list at lists.umanitoba.ca skrev:
> Hi.
> I cannot give you the comand syntax in epidata (maybe in Stata) but what
> you could simply do is the following:
> Create a variable first_visit_date = min(visit_date) by (id_unique)
> select where visit_date = firs_visit_date.
> 
> Serge
> 
> 2014-09-29 14:41 GMT+02:00 <<epidata-list at lists.umanitoba.ca>>:
> 
> > Dear ALL,
> > 
> > I have a data set where some patients have more than one entry (visit) i.e.
> > same patient with different visit dates, while some have only one entry
> > (visit). I would like to select only the first visit from each patient (The
> > variables to use are id_unique and visit_date)
> > 
> > Regards
> > 
> > Walter
> > _______________________________________________
> > EpiData-list mailing list
> > EpiData-list at lists.umanitoba.ca
> > <http://lists.umanitoba.ca/mailman/listinfo/epidata-list>
> > 
> > 
> 
> 
> -- 
> *M. Aymar Serge SOMDA, BEng. MMath. MSPH.*
> *Méthodologiste - Biostatisticien*
> *
> Chef Unité de Formation et d'Appui Méthodologique
> Centre MURAZ
> Bur: (226) 20 97 01 02 Poste 438
> GSM: (226) 70 44 33 22
> Bobo Dioulasso, Burkina Faso
> Email: <serge.somda at centre-muraz.bf>
> <http://www.centre-muraz.bf/>
> 
> Cellule de Biostatistique
> Institut Universitaire du Cancer
> Toulouse - Oncopole
> Bur: (33) (0)531 155 860
> GSM: (33) (0)604 521 773
> Toulouse, France
> Email: <somda.serge at iuct-oncopole.fr>
> <http://www.oncopole-toulouse.com/>
> 
> *
> *
> _______________________________________________
> EpiData-list mailing list
> EpiData-list at lists.umanitoba.ca
> <http://lists.umanitoba.ca/mailman/listinfo/epidata-list>
> 


More information about the EpiData-list mailing list