Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Indexing Question


From   "kelly johnson" <econometrics@hotmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Indexing Question
Date   Mon, 29 Aug 2005 11:48:26 -0400

Hi,

I have a question regading calculations and indexing. Below I have an except of a larrge data set. How can I calculate the percentage change in the variable X from the earliest date to the last date (e.g. in the case where id==1, the percentage change in X from 7/1/05-7/6/05). I want to do this by id for all my observations (i have thousands of obsevations and the date periods are of varying lengths...). I know it's of the 'by id:' type of statements, but I just can't get it right. Thank you.

Kelly


date id X
7/1/05 1 .2
7/2/05 1 .3
7/3/05 1 .2
7/4/05 1 .1
7/5/05 1 .5
7/6/05 1 .6
6/16/05 2 .4
6/17/05 2 .4
6/18/05 2 .4
6/19/05 2 .2
6/20/05 2 .1
6/21/05 2 .3
6/22/05 2 .5
4/11/05 3 .2
4/12/05 3 .8
4/13/05 3 .7
4/14/05 3 .8
4/15/05 3 .2
4/16/05 3 .2
4/17/05 3 .3
4/18/05 3 .1
4/16/05 3 .5
...

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

*
* 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