Statalist The Stata Listserver


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

st: RE: RE: summation (+ absolute value) formula


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: summation (+ absolute value) formula
Date   Tue, 7 Nov 2006 23:08:33 -0000

In a panel, I guess the second -replace- should 
be -by id:- also. Otherwise _N has the interpretation
of the number of observations in the dataset, not 
in each panel. 

Nick 
n.j.cox@durham.ac.uk 

Scott Merryman
 
> bysort id (t): gen foo = sum(abs((pip - l.pip)/l.pip))
> replace foo = . if t  <   t[_N -2]

west--@libero.it
 
> > 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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index