Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: taking the average of duplicate observations


From   Michael Tekle Palm <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: taking the average of duplicate observations
Date   Fri, 3 May 2013 12:48:01 +0200

Hello Statalist!

I have observations with identical time values but different outcome values. Instead of dropping all but the first observations for every two/three duplicates, I want to calculate and replace with the average of the observations, and then drop the duplicates.

So my data is on rainfall for a given location and is disaggregated by year and month. E.g:

Station  |  Year  |  Month  |  Rainfall
---------------------------------------
    1       1980       1          5
    1       1980       1          3          
    1       1980       2          4
    1       1980       3          8
    1       1980       3          1


So for each duplicate by station year month, I would like to calculate the average value for the rainfall outcomes, use this value and drop all duplicates. I think the solution suggested in this ["RE: st: questions about duplicate observations"] Statalist reply may work, but I wasn't quite able to make it work.


Thanks a lot,

Mike 		 	   		  
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index