Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: New variable based on a sum of products of another variable
From
"Seamer Paul" <[email protected]>
To
<[email protected]>
Subject
st: New variable based on a sum of products of another variable
Date
Tue, 17 May 2011 12:45:00 +0100
Hi Statalisters
Any advice much appreciated,
I'm trying to create a new variable based on a sum of products covering a moving range of another variable,
I think this will be clearest if I use an example,
I have a variable 'var2' and want to generate a new variable 'newvar' equal to a sum of products covering
moving ranges of 'var2' (the values below are not significant, just wanted to keep it simple).
var2 newvar
2 2
4 (2*4) + 4
6 (2*4*6) + (4*6) + 6
8 (2*4*6*8) + (4*6*8) + (6*8) + 8
10 (2*4*6*8*10) + (4*6*8*10) + (6*8*10) + (8*10) + 10
... ...