Hello,
I have data that takes the following form:
data have;
input month y;
1 1
2 3
3 2
4 3
5 2
6 1
7 2
8 2
9 2
10 3
;
run;
And I want to create a column that, each month, calculates the cumulative product of all of the variable Y. So for month 1, it would have a value of 1, then for month 2, it would be 3, then for month 3, it would be 6, and for month 4, it would be 18.
I could do this by transposing the columns, but I have hundreds of observations I need to do this with, so I am trying to find a more elegant way.
Your help is truly appreciated!
Thanks,
John