Good day,
I am trying to calculate the correlation between temperature and national gas consumption for several weather stations. This would be an easy task if my data was structured with variables being date, national gas consumption, weather measured at station 1, weather measured at station 2, and so forth. My data set with gas consumption is simply structured as data and gas consumption as the variables, with the inputs being clear. However, my weather data is structured as follows, which continues for all the weather stations: (Note that gas consumption is not yet included here)
As a consequence, my different stations are not specified as variables, but rather as inputs of the variable "staid" or "staname".
I am quite stuck with how to merge these data sets and calculate the correlation for each weather station. Merging is difficult because in my weather data set every date occurs multiple times (for every station) rather than just once. I have looked into reshape to get the staid inputs as separate variables but I could not work this out due to a lack of Stata skills.
Is there anyone that could help me with this?
Many thanks!
I am trying to calculate the correlation between temperature and national gas consumption for several weather stations. This would be an easy task if my data was structured with variables being date, national gas consumption, weather measured at station 1, weather measured at station 2, and so forth. My data set with gas consumption is simply structured as data and gas consumption as the variables, with the inputs being clear. However, my weather data is structured as follows, which continues for all the weather stations: (Note that gas consumption is not yet included here)
As a consequence, my different stations are not specified as variables, but rather as inputs of the variable "staid" or "staname".
I am quite stuck with how to merge these data sets and calculate the correlation for each weather station. Merging is difficult because in my weather data set every date occurs multiple times (for every station) rather than just once. I have looked into reshape to get the staid inputs as separate variables but I could not work this out due to a lack of Stata skills.
Is there anyone that could help me with this?
Many thanks!
Comment