Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 73303

Identifying occurrence of different events within a time period

$
0
0
Dear Statalist,


My longitudinal dataset is organized in the following way:

variables: ID, test (categorical 1/4), date (in %td format)

​I am interested in flagging a person if within 6 months period all four different tests were performed. The problem is that in some cases a certain test has been performed several times, in other cases not at all. I will try to make it clear with the following example:



ID TEST DATE
1 1 11Jun2005
1 3 11Sep2008
1 1 11Sep2008
1 2 20Sep2008
1 4 20Nov2008
2 4 10Nov2009
2 4 13Dec2009
3 2 01Feb2011
3 2 01Mar2011
3 2 03Mar2011
3 4 03Mar2011
3 1 03Mar2011
3 1 05May2011


If you look at the example the first person has all the four test performed within a 6 months period of time (3,1,2,4. Row from 2 to 5) and, therefore, I should flag it positively. On the contrary, the third person doesn't have the test n.3 in that specific time interval, therefore, I cannot flag it.
I have tried to think of a way to do this on Stata but the fact that tests have been performed randomly and without a specific order is making it quite complicated for me.

Any idea how shall I sort this out?

Thanks,

E.

Viewing all articles
Browse latest Browse all 73303

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>