I am currently working on a project which observes an identical product that being offered by multiple sellers for discrete periods of time. I am interested in understanding how the cheapest price of the product has changed with time. To give a bit more understanding, I have included a table below which illustrates what our dataset looks like:
Seller ID | Startdate | Enddate | Price |
A | 1jun2017 | 2jan2018 | 100 |
A | 1jan2018 | 20may2018 | 110 |
B | 5apr2017 | 18jul2018 | 130 |
Basically the desired output for this project would include the cheapest price provided by each seller for every date between 1 Jan 2016 and 31 May 2019. I have tried to show what this might look like below:
Date | A | B |
2jan2018 | 100 | 130 |
3jan2018 | 110 | 130 |
The closest I have managed to get to this output is through a loop - however, my knowledge of looping is somewhat limited and I haven't been able to get the data into my desired format. The code I used is as follows:
Code:
forvalues i = 20454(1)21700 { table seller if startdate<`i' & enddate>`i', c(min price) }
I would really appreciate any help that anyone can provide me!
Thanks
0 Response to Creating a time series that displays the minimum price for multiple offers of the same item that run for discrete time periods
Post a Comment