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/