Suppose I have the dataset
|ID |
| 1 | | 1 | | 1 | | 1 | | 2 | | 2 | | 2 |
I want to create a new variable where I add all the rows with the same ID number. It should look like
ID | New |
---|---|
1 | 4 |
1 | 4 |
1 | 4 |
1 | 4 |
2 | 3 |
2 | 3 |
2 | 3 |
Because I have four 1s, and three 2s.