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 on April 23, and its replacement, statalist.org is already up and running.


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

st: RE: Calculating Averages of Each Observation for Panel Data


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Calculating Averages of Each Observation for Panel Data
Date   Thu, 24 Nov 2011 19:54:37 +0000

. help collapse 

for closest Stata command. 

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

Andrew Wong Yoon Loong

I am working with panel data that is similar to the following:

Station Year    Month    V1     V2
1         1990    1             25      25
1         1990    5             60      12
1         1990    7              0       .
1         1991    1              .       .
1         1991    6            300     50
2         1990    1             25      25
2         1990    5             60      12
2         1990    7             0       .
2         1991    1              .       .
2         1991    6             300     50

Is there a command in Stata that will allow me to calculate the annual
average values for V1 and V2 for each individual station such that I
will get a dataset resembling the one below? Or do I have to manually
calculate using the average() function in Excel?

Station Year    V1      V2
1         1990
1         1991
2         1990
2         1991


Regards
Andrew

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

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