Hi
I had some problems describing the problem nicely, however I think this explanation will make it clear:
My data looks like this:

Code:
clear
input str7 subject double(observation_start_date time_start time_end flowrate_per_hour amount)
"tom"     21913 1.8934416e+12 1.8935784e+12 3 114
"tom"     21913 1.8936108e+12 1.8936216e+12 5  15
"carlos"  21917  1.893834e+12 1.8940248e+12 2 106
"natasha" 21926  1.894446e+12 1.8946224e+12 7 343
end
format %td observation_start_date
format %tc time_start
format %tc time_end
flowrate_per_hour is the amount of a drug given continuously per hour between time_start and time_end. Variable amount gives the total amount given over that timespan. observation_start_date gives the date where the observation period for a study started. Now I would like a dataset that indicates how much of the drug was given on each individual calenderdate, day 1 being observation_start_date.
This would like this:


Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str7 var1 byte day1 int day2 byte(day3 day4 day5 day6)
"tom"      0  12 72 45  0 0
"carlos"   0   0 30 48 28 0
"natasha" 91 168 84  0  0 0
end
I struggled quite a bit to solve this, does anyone have some valued input on how to solve this?

Yours sincerely

Fab