Hi Walter,
You could create a count of the number of records per unique individual and then select the first record:
Sort idunique visitdate
gen i count = 1
Var Name count of type Integer and length: 9 decimals 0
if idunique = idunique[_n-1] then count= count[_n-1] + 1
count= count[_n-1] + 1
the [_n] indicates recnumber and by subtracting one "_n-1" we get the previous record
select if count=1
Hope this helps,
Renate
-----Original Message-----
From: epidata-list-bounces(a)lists.umanitoba.ca [mailto:epidata-list-bounces@lists.umanitoba.ca] On Behalf Of epidata-list-request(a)lists.umanitoba.ca
Sent: Monday, September 29, 2014 1:01 PM
To: epidata-list(a)lists.umanitoba.ca
Subject: EpiData-list Digest, Vol 130, Issue 7
Send EpiData-list mailing list submissions to
epidata-list(a)lists.umanitoba.ca
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.umanitoba.ca/mailman/listinfo/epidata-list
or, via email, send a message with subject or body 'help' to
epidata-list-request(a)lists.umanitoba.ca
You can reach the person managing the list at
epidata-list-owner(a)lists.umanitoba.ca
When replying, please edit your Subject line so it is more specific than "Re: Contents of EpiData-list digest..."
EpiData-list mailing list
___________________________________
Today's Topics:
1. (no subject) (epidata-list(a)lists.umanitoba.ca)
2. Re: (no subject) (epidata-list(a)lists.umanitoba.ca)
3. Re: first observation among several for each person (no
subject) (epidata-list(a)lists.umanitoba.ca)
4. Re: (no subject) (epidata-list(a)lists.umanitoba.ca)
----------------------------------------------------------------------
Message: 1
Date: Mon, 29 Sep 2014 15:41:17 +0300
From: epidata-list(a)lists.umanitoba.ca
Subject: [EpiData-list] (no subject)
To: epidata-list(a)lists.umanitoba.ca
Message-ID:
<CAMLtmTBnDMV9Lrnq2UxM5t9H4Nd9B41aHJULbr1Y5qDL=3NY5Q(a)mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
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
------------------------------
Message: 2
Date: Mon, 29 Sep 2014 15:56:52 +0200
From: epidata-list(a)lists.umanitoba.ca
Subject: Re: [EpiData-list] (no subject)
To: epidata-list(a)lists.umanitoba.ca
Message-ID:
<CAHDXojvVqiyuSKVToxE4q82DFva6Bv6+bddzpKhxqX7FNbmV1w(a)mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
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(a)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(a)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(a)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(a)iuct-oncopole.fr
http://www.oncopole-toulouse.com/
*
*
------------------------------
Message: 3
Date: Mon, 29 Sep 2014 15:26:53 GMT
From: epidata-list(a)lists.umanitoba.ca
Subject: Re: [EpiData-list] first observation among several for each
person (no subject)
To: <epidata-list(a)lists.umanitoba.ca>
Message-ID: <1412004413115.66366.16794@webmail5>
Content-Type: text/plain; charset=UTF-8
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(a)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(a)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(a)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(a)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(a)iuct-oncopole.fr>
> <http://www.oncopole-toulouse.com/>
>
> *
> *
> _______________________________________________
> EpiData-list mailing list
> EpiData-list(a)lists.umanitoba.ca
> <http://lists.umanitoba.ca/mailman/listinfo/epidata-list>
>
------------------------------
Message: 4
Date: Mon, 29 Sep 2014 11:36:11 -0400
From: epidata-list(a)lists.umanitoba.ca
Subject: Re: [EpiData-list] (no subject)
To: EpiData List <epidata-list(a)lists.umanitoba.ca>
Message-ID: <BLU436-SMTP2503B22D35AA5A8742A58E3FDBA0(a)phx.gbl>
Content-Type: text/plain; charset="windows-1252"
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(a)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(a)lists.umanitoba.ca
> http://lists.umanitoba.ca/mailman/listinfo/epidata-list
>
------------------------------
________________________________________
EpiData-list(a)lists.umanitoba.ca
http://lists.umanitoba.ca/mailman/listinfo/epidata-list
End of EpiData-list Digest, Vol 130, Issue 7
********************************************
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
All you have to do, is to define a key, which you find under project properties. After definition of a key, only one observation can be entered for each value.
In entryclient a key is always what was "key unique" in Classic Epidata 3.1.
Regards Jens Lauritsen
epidata-list(a)lists.umanitoba.ca skrev:
>Dear all,
>
>I have tried to use epidata manager & client. The Entry client is not indicating on duplicate entry of id field as in Epi data classic 3.1. Please let me know if there is any option to give message just after entering the key field and stop the entry to next fields.
>
>Thanks & best regards,
>Rasool Bux
>
>________________________________
>
>This e-mail may contain information that is privileged or confidential. If you are not the intended recipient, please delete the e-mail and any attachments and notify us immediately.
>_______________________________________________
>EpiData-list mailing list
>EpiData-list(a)lists.umanitoba.ca
>http://lists.umanitoba.ca/mailman/listinfo/epidata-list
Dear Jens,
Is there a web-tutorial for Epidata manager and Client?
It would be of great help
Basic things are simple to figure out as they are simple if you know the epidata entry 3.1
More advanced work requires some help!
regards
Thambu
Dear all,
I have tried to use epidata manager & client. The Entry client is not indicating on duplicate entry of id field as in Epi data classic 3.1. Please let me know if there is any option to give message just after entering the key field and stop the entry to next fields.
Thanks & best regards,
Rasool Bux
________________________________
This e-mail may contain information that is privileged or confidential. If you are not the intended recipient, please delete the e-mail and any attachments and notify us immediately.
Dear Epidata users
I am facing a problem transferring a field value from a parent file to a
child file.
In the parent file I have initial SRQ (srqinit) and I want the same value
to appear in the chiled file.
I did the following:
In the parent file
before file
Define Gsrqinit ## Global
srqinit
MUSTENTER
AFTER ENTRY
LET Gsrqinit=srqinit
END
END
In the child file
BEFORE RECORD
srqinit=varsrqinit
END
However, this doesn't seem to work. Your help will be most appreciated.
Mohammed
--
*---------------------------------------------------------*
Hi there
I have created a relational database for two files. A pre-entry data file
(parent file) and an intake file (child file). the relate command is
working well. However, when finishing information entry in the child file
and go back to the main file using F10 , EpiData doesn't take me
automatically to a new parent file but to the previous file and a new
parent file will only open when using the navigation bottom. Also when I
fill in the second parent file and automatically move to the child file, I
found the information entered for the previous child file. Hope you can
help me solving this problem
Thanks
Mohamed
--
*---------------------------------------------------------*