I have a payoff variable for individuals, each uniquely identified by their ID variable. The payoff for each person also each spans over four consecutive days (not necessarily the same ones), which has its own variable with values ranging from 1-4.

My question is how would you generate a variable that displays the accumulating payoffs for days 1-4 for each ID?

For example, if the payoff for person A is 1 1 1 1 for each day respectively and for person B this is 2 2 2 2,

the new variable should then show payoffs for A: 1 2 3 4 and for B: 2 4 6 8.

Any help is much appreciated!

Cheers!