I have data like this
For each participant I need 5 PSAs for each PSA date that are: before that PSA Date and the span for those 5 values has to be at least 12 months and no more than 24 months. So, for each participant the first four values will not have a grouping of their own, but if there is a fifth value then I can check to see if there are four lower (datewise) values that fall within the required window. Then if there is a sixth I can see if there are four lower (datewise) values that fall within the required window. and so on and so on for each PSA record for each participant. Each record can be in up to 5 different groups. Any suggestions?
wb
Code:
STUDY_PARTICIPANT_ID PROC_LABS_PSA_DATE PROC_LABS_PSA_VALUE Phase
08800021 2008-07-02 00:00:00.000 1.44 BLN
08800021 2008-10-13 00:00:00.000 1.30 BLN
08800021 2009-02-09 00:00:00.000 1.20 FU
08800021 2009-04-01 00:00:00.000 1.40 FU
08800021 2009-07-01 00:00:00.000 1.43 FU
08800021 2009-10-14 00:00:00.000 1.33 FU
08800021 2009-12-15 00:00:00.000 2.01 FU
08800021 2010-04-05 00:00:00.000 5.30 FU
08800021 2010-07-05 00:00:00.000 1.60 FU
08800021 2010-09-24 00:00:00.000 1.50 FU
08800021 2010-12-29 00:00:00.000 1.40 FU
08800021 2011-04-14 00:00:00.000 1.80 FU
08800021 2011-06-24 00:00:00.000 1.60 FU
08800021 2011-09-28 00:00:00.000 1.30 FU
08800021 2011-12-16 00:00:00.000 1.90 FU
08800021 2012-04-13 00:00:00.000 1.90 FU
08800021 2012-08-08 00:00:00.000 1.90 FU
08800518 2005-02-17 00:00:00.000 19.50 BLN
08800518 2007-06-18 00:00:00.000 1.60 BLN
08800518 2008-06-25 00:00:00.000 1.40 BLN
08800518 2009-01-15 00:00:00.000 2.30 BLN
08800518 2009-08-10 00:00:00.000 2.06 BLN
08800518 2009-11-04 00:00:00.000 1.50 BLN
08800518 2010-05-05 00:00:00.000 3.60 FU
08800518 2010-12-03 00:00:00.000 3.30 FU
08800518 2011-03-02 00:00:00.000 2.80 FU
08800518 2011-05-05 00:00:00.000 3.80 FU
08800534 2009-01-27 00:00:00.000 4.30 BLN
08800534 2009-02-09 00:00:00.000 3.30 BLN
08800534 2009-03-16 00:00:00.000 4.40 BLN
08800534 2009-09-09 00:00:00.000 4.62 BLN
08800534 2010-07-19 00:00:00.000 4.60 FU
08800534 2010-10-29 00:00:00.000 5.10 FU
08800534 2011-05-13 00:00:00.000 5.30 FU
08800534 2012-01-23 00:00:00.000 5.90 FU
08800534 2012-08-07 00:00:00.000 6.30 FU
For each participant I need 5 PSAs for each PSA date that are: before that PSA Date and the span for those 5 values has to be at least 12 months and no more than 24 months. So, for each participant the first four values will not have a grouping of their own, but if there is a fifth value then I can check to see if there are four lower (datewise) values that fall within the required window. Then if there is a sixth I can see if there are four lower (datewise) values that fall within the required window. and so on and so on for each PSA record for each participant. Each record can be in up to 5 different groups. Any suggestions?
wb