Dear all,
I am currently writing my master thesis and I am a beginner in STATA.
I need to merge two datasets that have a different time format.
The first data set has the following format with a panel data set given quarter-hourly. It looks something like this:
begintime endtime Total_Load
01jan2015 00:00:00 01jan2015 00:15:00 44840
01jan2015 00:15:00 01jan2015 00:30:00 42412
01jan2015 00:30:00 01jan2015 00:45:00 41901
01jan2015 00:45:00 01jan2015 01:00:00 40710
The second data set has a format that looks like this where begin and endtime is always different:
begintime endtime Output
01jan2015 00:00:00 01jan2015 01:15:00 318
01jan2015 00:00:00 02jan2015 01:00:00 82
01jan2015 03:00:00 01jan2015 05:00:00 215
01jan2015 11:00:00 01jan2015 14:00:00 1971
I need to merge the two datasets and the goal of the analysis is to get the mean of the Total_load and Output per hour each day.
My Professor told me that I need to use the reshape command to transform the second dataset since the observations must have a unique identifer to be able to merge. However, the second dataset has repeated observations in begin and endtime.
How can I generate a unique id for such a dataset? or how can I reshape such dataset from long to wide?
I would appreciate any advice. Thank you in advance for any help.
I am currently writing my master thesis and I am a beginner in STATA.
I need to merge two datasets that have a different time format.
The first data set has the following format with a panel data set given quarter-hourly. It looks something like this:
begintime endtime Total_Load
01jan2015 00:00:00 01jan2015 00:15:00 44840
01jan2015 00:15:00 01jan2015 00:30:00 42412
01jan2015 00:30:00 01jan2015 00:45:00 41901
01jan2015 00:45:00 01jan2015 01:00:00 40710
The second data set has a format that looks like this where begin and endtime is always different:
begintime endtime Output
01jan2015 00:00:00 01jan2015 01:15:00 318
01jan2015 00:00:00 02jan2015 01:00:00 82
01jan2015 03:00:00 01jan2015 05:00:00 215
01jan2015 11:00:00 01jan2015 14:00:00 1971
I need to merge the two datasets and the goal of the analysis is to get the mean of the Total_load and Output per hour each day.
My Professor told me that I need to use the reshape command to transform the second dataset since the observations must have a unique identifer to be able to merge. However, the second dataset has repeated observations in begin and endtime.
How can I generate a unique id for such a dataset? or how can I reshape such dataset from long to wide?
I would appreciate any advice. Thank you in advance for any help.
Comment