Hello everyone, I've tried tackling the problem below multiple ways including using FIRST. and LAST. in BY-GROUP analysis, WHILE loops, but have not been unsuccessful so far. I'm running out of time and if anyone can provide some direction it'd be greatly appreciated. Here's the situation: I have a data set which is 'tenurized' based on the occurrence of a particular event. In this case, the event being a 'limit placement' which happens at a particular date defined as 'Limit_dt'. Therefore, as of the 'Limit_dt' the 'Tenure' field gets set to = 0 and increments by 1 until the last row for that particular customer group (ID). The data is sorted by ID, Limit_dt and Date. See below an illustration of what the data looks like as well as better explanation of each field. Field Tenure2 (highlighted in yellow) is what I'm attempting to tackle right now. Please ignore it for now. Essentially, what I need to do here is 're-tenurize' this data set based on the FIRST occurrence Score_flag ='Y' within each customer group. To expand a bit on this, Score_flag = 'Y' when Score >= Score30 so this flag can basically jump back and forth between 'Y' and 'N' from month to month. What I need to do is create a field named 'Tenure2' which gets set to '0' at the FIRST occurrence (and ONLY the first occurrence for each ID) of Score_flag='Y' for a particular ID and increment by 1 from there until the last record/row for that customer (ID). The field 'Tenure2' in the illustration above exemplifies the values that this field should take. Hoping someone can direct me to a simple solution to this. Thanks in advance for your support.
... View more