Dear All,
I guess this is a trivial question, but I simply didnt know how to search for the answer (I tried but failed).
I have a standard dataset with three variables ID Y X
The dataset has 100 observations.
I want to create two locals
1) the sum of all products Y*X,
....i.e. if I wanted to create it as a variable it would be
gen product=Y*X
egen sum_product=sum(product)
2)the average of that sum
How do I create these local directly (without first having to generate a variable)
Many thanks
Darjusch
I guess this is a trivial question, but I simply didnt know how to search for the answer (I tried but failed).
I have a standard dataset with three variables ID Y X
The dataset has 100 observations.
I want to create two locals
1) the sum of all products Y*X,
....i.e. if I wanted to create it as a variable it would be
gen product=Y*X
egen sum_product=sum(product)
2)the average of that sum
How do I create these local directly (without first having to generate a variable)
Many thanks
Darjusch
Comment