Hello. I have a dataset looks like the one provided below and need to count (not distinct) values of id2 by id1 through time (runningcount is the variable that I want). I have read the existing discussion on this topic (https://communities.sas.com/t5/SAS-Programming/Running-count-distinct-by-group-through-time/td-p/438839) and the 2 solutions works well for the original question. However, I need to restart the count when id2 changes (while keeping time in descending order). Data is sorted by id1 and time. Thank you in advance. @Ksharp id1 id2 time runningcount 1 A 20131128 1 1 A 20140530 2 1 A 20150217 3 1 B 20150410 1 1 B 20160612 2 1 B 20180101 3 1 C 20190101 1 2 A 19900515 1 2 A 19910522 2 2 B 19920101 1 2 B 19930321 2
... View more