Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long pump_id double timestamp float pumped 110020 1935171979000 1.47 110020 1935172277000 1.93 110020 1935172537000 2.61 110020 1935172779000 3.13 110020 1935173008000 3.44 110020 1935173298000 4.17 110020 1935173572000 4.63 110020 1935173797000 5.15 110020 1935173974000 5.63 110020 1935174245000 6.08 110020 1935174621000 6.81 110020 1935174986000 7.71 110020 1935175253000 8.27 110020 1935175495000 8.68 110020 1935175689000 9.1 110020 1935175892000 9.51 110020 1935176169000 10.03 110020 1935176418000 10.62 110020 1935176657000 11.14 110020 1935176871000 11.66 110020 1935177113000 12.01 110020 1935177362000 12.53 110020 1935177598000 13.05 110020 1935177918000 13.67 110020 1935178142000 14.19 110020 1935178341000 14.6 110020 1935178569000 15.12 110020 1935178749000 15.54 110020 1935178943000 15.85 110020 1935179127000 16.27 110020 1935179381000 16.87 110020 1935179622000 17.31 110020 1935179988000 18.14 110020 1935180348000 18.86 end format %tc timestamp
I have three variables, timestamp, pump_id, and a cumulative continuous variable, pumped. I have uneven intervals and my ultimate goal is to have a panel dataset with a time variable, which shows 10 minutes intervals. The issue is dividing the amount of pumped between two overlapping intervals. For example, from 19:59:39 to 20:03:28, the total amount pumped is 0.33. So, 21 seconds belong to the 19:50:00 interval and 3 minutes and 28 seconds belong to the 20:00:00 interval. I want to divide the pumped amount of 0.33 between the two intervals based on the linear weights given the time pumped in each interval. Is there any syntax to make this happen quickly?
Code:
pump_id timestamp pumped 110020 27apr2021 19:59:39 3.13 110020 27apr2021 20:03:28 3.44
Comment