I have a data set that spans 5 years from 2008-2012. I have four variables year-month-day-hour that together uniquely identify a particular hour in the dataset.
I used this code:
foreach x in buschranch campbell {
egen max_`x' = max(`x'), by (year month day)
}
Where buschranch and campbell are variables in my dataset (containing measures of output from wind turbines in each location) and I can generate new variables that uniquely identify the maximum value for each day in the dataset.
However, I also want to know which corresponding hour in each day is the maximum value... I've looked around at indexing stuff but I'm honestly not finding a solution that gives me what I want.
Essentially, I want to find the highest output and in what hour in each day, so eventually I can find on average, what is the most productive hour for a wind site. Hopefully that's clear enough, I appreciate any advice!
I used this code:
foreach x in buschranch campbell {
egen max_`x' = max(`x'), by (year month day)
}
Where buschranch and campbell are variables in my dataset (containing measures of output from wind turbines in each location) and I can generate new variables that uniquely identify the maximum value for each day in the dataset.
However, I also want to know which corresponding hour in each day is the maximum value... I've looked around at indexing stuff but I'm honestly not finding a solution that gives me what I want.
Essentially, I want to find the highest output and in what hour in each day, so eventually I can find on average, what is the most productive hour for a wind site. Hopefully that's clear enough, I appreciate any advice!
Comment