Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Average for panel data


From   SERGIO MOISES AFCHA CHAVEZ <s.afcha@ub.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: Average for panel data
Date   Wed, 15 Jul 2009 19:36:29 +0200

Dear statalisters,
I am working with an unbalanced panel Data. I?m trying to generate an average
measure with a database similar to this:
Id	Year	V1	 V2	V3=(v2/v1)       
1	1990	100	25	25
1	1991	500	60	12
1	1992	0	0	.
1	1993	.	.       .
1	1994	600	300	50
The average that I need should be the cumulative sum of the variable V3 divided
between the number of  years with values different from 0 or missing. For example:
year1990: (25/1)
year1991: ((25+12) /2)
year 1992: ((25+12)/2)
year 1993: ((25+12)/2)
year 1994: ((25+12+50) /3)
Only considering those years with information different from 0 or missing value. 
Thanks in advance for your help,
Sergio




-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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