I have data that look like this.
If any particular id has results <= 40 for six or more consecutive months, I want to know that. For example, for id==5 , result <=40 from 12/5/2012 to 12/20/2013, which is a year (>=6months)
It is not sufficient to just know which ids have results like that but I also need to have that period marked/tagged in some way.
I declared the data as an xtset but could not successfully use the commands within to fully benefit from that.
id | testname | result | resultdatetime |
5 | Some test | 40 | 12/5/12 11:54 |
5 | Some test | 39 | 4/1/13 9:24 |
5 | Some test | 25 | 12/20/13 9:10 |
5 | Some test | 100 | 7/10/14 16:39 |
5 | Some test | 40 | 8/13/14 15:40 |
8 | Some test | 40 | 2/28/13 10:59 |
8 | Some test | 540 | 8/19/13 13:32 |
8 | Some test | 40 | 6/19/14 8:27 |
8 | Some test | 40 | 7/14/14 16:33 |
8 | Some test | 40 | 2/10/15 8:44 |
39 | Some test | 40 | 4/13/14 3:30 |
39 | Some test | 40 | 5/11/14 8:10 |
39 | Some test | 40 | 8/10/14 8:20 |
39 | Some test | 77869 | 2/10/15 10:48 |
57 | Some test | 40 | 7/19/12 17:00 |
57 | Some test | 10563 | 12/9/13 17:04 |
57 | Some test | 40 | 5/24/14 4:39 |
64 | Some test | 40 | 7/2/13 11:10 |
64 | Some test | 1128 | 12/2/13 16:36 |
64 | Some test | 981 | 12/13/13 10:12 |
64 | Some test | 435 | 1/13/14 10:02 |
64 | Some test | 1439 | 1/27/14 15:15 |
64 | Some test | 2755 | 4/14/14 17:05 |
64 | Some test | 199 | 6/2/14 16:56 |
64 | Some test | 49090 | 8/27/14 15:46 |
64 | Some test | 40 | 11/3/14 15:12 |
64 | Some test | 1041 | 2/12/15 16:28 |
It is not sufficient to just know which ids have results like that but I also need to have that period marked/tagged in some way.
I declared the data as an xtset but could not successfully use the commands within to fully benefit from that.
Comment