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: Merging/summing daily values across time periods in (unbalanced) panel dataset


From   Amanda Dwelley <[email protected]>
To   [email protected]
Subject   st: Merging/summing daily values across time periods in (unbalanced) panel dataset
Date   Tue, 8 Mar 2011 17:15:33 -0500

Hello,

I'm looking for suggestions on how to join and sum daily x values from one
dataset into time periods defined by a start date and end date in another
(panel) data set.

Master data set looks like:
id date_from date_to
1 07apr2009 09jun2009
1 10jun2009 03jul2009
2 13jun2009 10jul2009
2 11jul2009 05aug2009
(~50,000 observations; time periods at irregular intervals)

Daily data looks like:
date x1 x2
02jun2009 5.7 0
03jun2009 2.3 0
04jun2009 0 2
05jun2009 0 3.5
(3 yrs of daily values)

As you can see the using data could be in wide or long format.
If I merge the wide format daily data into the master dataset, is there any
way to reference/look for the dates in variable names that are between the
start/end date, and sum associated variables? If using the long format of
the daily data, is there a way to sum values between start/end dates during
a join or merge?

Any suggestions would be very much appreciated!

Thanks,
Amanda
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index