Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: summation (+ absolute value) formula


From   "Scott Merryman" <[email protected]>
To   <[email protected]>
Subject   st: RE: summation (+ absolute value) formula
Date   Tue, 7 Nov 2006 17:01:21 -0600

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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index