Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: how to generate mean for a secquence of five year of a variable


From   Oliver Jones <ojones@wiwi.uni-bielefeld.de>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: how to generate mean for a secquence of five year of a variable
Date   Thu, 05 May 2011 14:33:02 +0200

Just to clarify, do mean something like this?



You have:

id	time	var1
1	1980	3
1	1981	6
1	1982	8
1	1983	4
1	1984	2
(all the other years...)
1	2000	8
1	2001	7
1	2002	8
1	2003	9
1	2004	3




And you want:

id	time	var1	var2
1	1980	3	mean_up_to_1985
1	1981	6	mean_up_to_1986
1	1982	8	mean_up_to_1987
1	1983	4	mean_up_to_1988
1	1984	2	mean_up_to_1989
(all the other years...)
1	2000	8	.
1	2001	7	.
1	2002	8	.
1	2003	9	.
1	2004	3	.

where the "." is meaning missing.

Best
Oliver

Am 05.05.2011 14:15, schrieb prakash singh:
Hello stata listers

I have a panel data with number of cuntries=15 and the time period of
the data set is 1980-81 to 2004-05. Now I want to generate a variable
say var2 from var1, where first observation in var2 is mean of the
var1 for year 1980-81 to 1984-85 then second observation is mean of
1986-90 and so on. I am working on stata10.

Suggest me how I can do it.

Kind Regards
Prakash
*
*   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/

--
Universität Bielefeld
Fakultät für Wirtschaftswissenschaften
Lehrstuhl für Ökonometrie und Statistik
- -
Bielefeld University
Faculty of Business Administration and Economics
Chair of Econometrics and Statistics
- -
Raum / room:  V9-110
Tel / phone:  +49 (0)521 106 4871
---
*
*   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   |   Site index