I have a dataset and need to create a new variable that will populate the row-wise occurrence of value per the variable in the sorted dataset as shown below.
VAR1 VAR2 (to be created)
C1 1
C1 2
C1 3
C2 1
C3 1
C3 2
C4 1
C5 1
Thanks for the help in advance.