bysort id (t): gen foo = sum(abs((pip - l.pip)/l.pip))
replace foo = . if t < t[_N -2]
Scott
> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of [email protected]
> Sent: Tuesday, November 07, 2006 3:22 PM
> To: statalist
> Subject: st: summation (+ absolute value) formula
>
> I need some help, thank you in advance.
>
> Given a variable (taken from a set of n variables in a panel), called
> "Pippo", I need to compute the following formula:
>
> Somma_(i=t-2 to t) of Absolute_value[(Pippo(i) - Pippo(i-1))/Pippo(i-1)]
>
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/