Hi, I am working with the following sample of intra-day data:
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float id long date double(time price) float date_dummy
1 21823           56100000    102.387 .
1 21824           33596000    102.288 .
1 21824           47710000    102.397 .
1 21825           50009000    102.742 .
1 21825           60499000 102.702736 .
1 21826           12119000    102.582 1
1 21826           32789000    102.565 1
1 21826           43951000    102.609 1
1 21826           54412000    102.617 1
1 21826           54412000  102.55451 1
1 21829           37797000    102.545 .
1 21829           45684000    102.522 .
1 21830           44628000    102.536 .
1 21831           35067000    102.645 .
1 21831           37511000    102.542 .
1 21831           48165000    102.174 .
1 21831           48165000    102.474 .
1 21831           64399000   102.4974 .
1 21831           64399000   102.4974 .
1 21832           36633000    102.355 1
1 21832           57553000    102.299 1
1 21832           57995000 102.338645 1
1 21833           40237000    102.319 .
1 21836           57954000 102.080452 .
1 21837           30188000    102.332 .
1 21837 32455999.999999996    102.268 .
1 21837           44701000    102.073 .
1 21838 32155999.999999996    102.259 .
1 21838           33861000    102.403 .
1 21838           33861000    102.403 .
1 21838           33861000    102.403 .
1 21839           40823000    102.237 .
1 21839           40823000    102.237 .
1 21840           10127000    102.424 .
1 21840           28777000    102.423 .
1 21840           42387000    102.453 .
1 21840           42387000    102.453 .
1 21843           36383000     102.36 .
1 21843           42529000    102.327 .
1 21843           44051000     102.39 .
1 21843           46214000    102.356 .
1 21843           46214000    102.206 .
1 21843           46214000    102.206 .
1 21843           47160000    102.287 .
1 21843           47160000    102.137 .
1 21843           47160000    102.137 .
1 21843           54017000    102.389 .
1 21844           42487000    102.378 .
1 21844           51397000    102.388 .
1 21844           56163000    102.403 .
1 21845           31133000    102.336 .
1 21845           39218000     102.36 .
1 21845           40921000    102.353 .
1 21845           57404000    102.357 .
1 21846           33927000    102.367 .
1 21846           33927000 102.315821 .
1 21846           37407000    102.452 .
1 21846           37795000    102.537 .
1 21846           40807000    102.437 .
1 21846           40807000    102.437 .
1 21846           43021000    102.497 .
1 21847           21949000    102.467 .
1 21847           29852000    102.238 .
1 21850 32089000.000000004    102.146 .
1 21850           33233000    102.087 .
1 21851           35148000    102.856 .
1 21851           35149000    102.189 .
1 21851           37061000    102.181 .
1 21851           41673000    102.189 .
1 21851           63717000    102.268 .
1 21852 31804000.000000004    102.134 .
1 21852           31821000    102.095 .
1 21852           38297000    102.235 .
1 21852           38310000    102.235 .
1 21852           40491000    102.155 .
1 21852           55524000    102.261 .
1 21853           34598000    102.172 .
1 21853           34598000    102.272 .
1 21853           42468000    102.357 .
1 21854           49875000  102.38718 .
1 21854           49875000  102.35594 .
1 21857           35252000    102.308 .
1 21857           53270000    102.244 .
1 21858           36819000    102.148 .
1 21858           40646000    102.207 .
1 21858           55883000    102.214 .
1 21858           59147000 102.186285 .
1 21859           36765000    102.232 .
1 21859           37575000    102.278 .
1 21859           39973000    102.165 .
1 21859           51312000    102.197 .
1 21860           40842000     102.07 .
1 21861           54688000   101.9095 .
1 21861           54688000   102.0095 .
1 21865           36402000    102.038 .
1 21865           43839000    101.891 .
1 21865           43839000    101.954 .
1 21865           43978000    101.948 .
1 21865           52278000    102.017 .
1 21865           58523000    101.968 .
end
format %td date
format %tcHH:MM:SS time
I want to take the summation of the price over the next 30 days/month from the point/day when the date_dummy takes the value of 1. I only show date_dummy for two days here but in actual data there are more values. I can define the business calendar, but since the data is intra-day I am having difficulty in defining the next 30 days/month as there are multiple values within a day. Would appreciate help in this regards. Thank You.