Hello,

I appreciate your help on this.

I have patient level data with and ID and subID. I want to generate the sequence (such as 1,2,3,4...) for the subID group within the ID.

e.g., this is how my data looks like
ID SubID
A x
A x
A y
A y
B m
B m
B n
B n
B o
B o

I want the sequence to be generated as follows
ID SubID Sequence
A x 1
A x 1
A y 2
A y 2
B m 1
B m 1
B n 2
B n 2
B o 3
B o 3

appreciate your support very much