Dear SAS community,
 
Edit: My Apologies, I have amended the question.
 
This is yet another counting with the condition that I have been struggling with. Please help!
Your help would be much appreciated.
Suppose that I have data below;
 
Subject / Year / Condition
 
A 1991 1
A 1992 1
A 1993 2
A 1994 2
A 1995 3
A 1996 1
A 1997 1
B 1991 2
B 1992 1
B 1993 2
B 1994 1
B 1995 3
B 1996 1
B 1997 2
 
 
 
I cannot change the order of this, and I would like to start counting
when "1" appears and continue counting without counting '2' or '3' so that I get
 
Subject / Year / Condition / Count
 
A 1991 1    1
A 1992 1    2
A 1993 2    2
A 1994 2    2
A 1995 3    2
A 1996 1    3
A 1997 1    4
 
B 1991 2    0
B 1992 1    1
B 1993 2    1
B 1994 1    2
B 1995 3    2 
B 1996 1    3
B 1997 2    3
 
How can I achieve this? 
 
Basically the end goal is to then find the number of each 1, 2, 3 and find the percentage of them to select which one I would choose based on the highest probability. But I will need to find a solution to this first.
Thank you!
Regards,
 
T