Hi everyone,
I have data set from which I need to add the 1st, 2nd, 3rd, 4th, ..., nth value up in each subgroup.
For example, the data set looks like,
Name Year_count Starting_Year
A 7 1995
A 4 2000
B 2 1997
B 4 2000
C 3 2003
C 1 2006
C 2 2007
..................................................
X 5 1992
X 3 1997
X 1 2000
I want to put the first observation in A, B, C, ...., and X in a new group, the 2nd observation in A, B, C,... and X in a new group, and so on. The number of observation in each subgroup by name may vary, 2 for A, 2 for B, 3 for C,..., 3 for X.
the outcome will look like,
Name Year_count Starting_Year
A 7 1995
B 2 1997
C 3 2003
...............................................
X 5 1992
Please help me, thanks!