Dear Statalisters,
This is my first post here.
I am looking for a way to generate the product of the observations within a variable so that I have a separate column of identical values, each being the product of all the observations of the said variable, like egen total() does with the sum.
To make an example, if X is my variable, I would have X= (x1, x2, x3, x4) and I would like to have ProdX = (x1*x2*x3*x4,...)
To the best of my knowledge (that may be very poor, since it's not been long that I encountered this issue) I have not found an answer in a previous post. The next best thing I found was the prod plugin, but it seems to me it's more an analogous to the sum option rather than total.
I sincerely hope I was clear enough.
Thank you for any contribution.
Tommaso
This is my first post here.
I am looking for a way to generate the product of the observations within a variable so that I have a separate column of identical values, each being the product of all the observations of the said variable, like egen total() does with the sum.
To make an example, if X is my variable, I would have X= (x1, x2, x3, x4) and I would like to have ProdX = (x1*x2*x3*x4,...)
To the best of my knowledge (that may be very poor, since it's not been long that I encountered this issue) I have not found an answer in a previous post. The next best thing I found was the prod plugin, but it seems to me it's more an analogous to the sum option rather than total.
I sincerely hope I was clear enough.
Thank you for any contribution.
Tommaso
Comment