In Epidata Analysis, do this: (I’m using id and visit - you cannot have names with underscores in classic Epidata and it is probably not a good idea in new Epidata)
define vfirst # vfirst = 1 sort id visit if id = id[recnumber-1] then vfirst = 0 select vfirst=1
id[recnumber-1] refers to the value of id in the previous record. Since the data are sorted first by id and then visit, this will leave vfirst=1 whenever id changes.
Jamie
On Sep 29, 2014, at 8:41 AM, epidata-list@lists.umanitoba.ca wrote:
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@lists.umanitoba.ca http://lists.umanitoba.ca/mailman/listinfo/epidata-list