Duration is the easy one here:
bys id: g duration=ageatvisit[_N]-ageatvisit[1]
But I just do not know what your frequency is supposed to mean. Please
specify...
Martin Weiss
_________________________________________________________________
Diplom-Kaufmann Martin Weiss
Mohlstrasse 36
Room 415
72074 Tuebingen
Germany
Fon: 0049-7071-2978184
Home: http://www.wiwi.uni-tuebingen.de/cms/index.php?id=1130
Publications: http://www.wiwi.uni-tuebingen.de/cms/index.php?id=1131
SSRN: http://papers.ssrn.com/sol3/cf_dev/AbsByAuth.cfm?per_id=669945
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of MAY BAYDOUN
Sent: Tuesday, June 10, 2008 7:46 PM
To: [email protected]
Subject: st: Duration and average frequency of examination
Dear statalisters,
I was wondering if you could help me figure out a way
to obtain the frequency at which each individual was
examined (i.e. average number of follow-up visits per
year) and the total duration (i.e. time between first
and last visit) if the dataset is person-period format
and I have the following structure:
id visit age at visit
1 1 30
1 2 32
1 3 36
1 4 50
2 1 45
2 2 46
3 3 50
3 4 56
3 5 60
3 6 65
4 1 42
4 2 48
In other words, the distance in age between visits
varies for each individual, the number of visits is
not the same and the age at baseline varies as well.
So, I would like to obtain the following variables
(made up numbers for frequencies):
id Freq Duration
1 0.5 20
2 0.4 1
3 0.3 15
4 0.6 6
The duration for individual 1 for example is:
50-30
The average frequency is the tricky one I guess, it is
for individual 1:
[1/(32-30) + 1/(36-32) + 1/(50-36)]/4
Thanks a lot and hope to hear from you soon,
Sincerely yours,
May
May Baydoun, PhD in Epidemiology (UNC-Chapel Hill)
Staff Scientist,
National Institute on Aging, NIH/IRP, Biomedical
Research Center,
Baltimore, MD
May Baydoun, PhD in Epidemiology (UNC-Chapel Hill) Staff Scientist,
National Institute on Aging, NIH/IRP, Biomedical Research Center,
Baltimore, MD
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/