Thank you! This works perfectly. This is in the realm of what I was trying but still wasn't working, the first.id wasn't working properly. The episode counter wasn't resetting back to 1 for every subsequent ID and was just counting increasingly. My issue was I had other things going on in the data step prior to the by statement that were messing with the "by variable" logic so once I took that out it worked perfectly.
... View more