Hi Statalist Community,
I'm writing to you because I have a rather complex task to do, and I don't really know how to go about it. I have two sets of data from two different sources, but with a few key variables that allow identification of the municipality (-municipio-), province (-province-), municipal code (-cmunine-), and date (-date-).
These are renewable energy projects accepted by government bodies in Spain. They include several sources (solar, wind, hydro, etc.). For simplicity here, I've only taken 5 observations from each set.
However, I notice visually (using -browse-) that some values from the -using- are not systematically listed in the -master- dataset. Here's an example that reflects this between April 2023 and September 2023 for both datasets:
-master- :
-using- :
What I'd like to do:
Thank you in advance!
Michael
I'm writing to you because I have a rather complex task to do, and I don't really know how to go about it. I have two sets of data from two different sources, but with a few key variables that allow identification of the municipality (-municipio-), province (-province-), municipal code (-cmunine-), and date (-date-).
These are renewable energy projects accepted by government bodies in Spain. They include several sources (solar, wind, hydro, etc.). For simplicity here, I've only taken 5 observations from each set.
However, I notice visually (using -browse-) that some values from the -using- are not systematically listed in the -master- dataset. Here's an example that reflects this between April 2023 and September 2023 for both datasets:
-master- :
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str31 municipio str22 province long cmunine int date double(power power_solar cumpower_solar) float(solar_dummy cumsolar_dummy) long renewables_type float N_projects_per_mun "Colmenar de Oreja" "Madrid" 28043 759 0 0 80 0 4 . 4 "Colmenar de Oreja" "Madrid" 28043 760 0 0 80 0 4 . 4 "Colmenar de Oreja" "Madrid" 28043 761 0 0 80 0 4 . 4 "Colmenar de Oreja" "Madrid" 28043 762 0 0 80 0 4 . 4 "Colmenar de Oreja" "Madrid" 28043 763 0 0 80 0 4 . 4 "Colmenar de Oreja" "Madrid" 28043 764 0 0 80 0 4 . 4 end format %tm date label values renewables_type renewables_type
-using- :
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str30 municipio str20 province float cmunine double(date power) float(power_solar cumpower_solar solar_dummy cumsolar_dummy) long renewables_type float N_projects_per_mun "Colmenar de Oreja" "Madrid" 28043 759 72500 72500 122500 1 2 5 3 "Colmenar de Oreja" "Madrid" 28043 759 50000 50000 50000 1 1 5 2 "Colmenar de Oreja" "Madrid" 28043 759 75000 75000 197500 1 3 5 1 "Colmenar de Oreja" "Madrid" 28043 760 0 0 197500 0 3 . 3 "Colmenar de Oreja" "Madrid" 28043 761 0 0 197500 0 3 . 3 "Colmenar de Oreja" "Madrid" 28043 762 0 0 197500 0 3 . 3 end format %tm boe_date_monthly label values renewables_type encoded_renewables_type label def encoded_renewables_type 5 "Solar", modify
What I'd like to do:
- First, find out whether or not the datasets diverge systematically for each of the municipalities at a given time.
- Secondly, if the -master- does not include certain values, I would like to merge those that are available in the -using-, but not in the “master”.
- Warning: in the -master- and -using-, a month can contain several entries, as shown by the wrong order in the -using- above of the variable -N_projects_per_mun-. This variable is supposed to count the number of projects per municipality over the entire period (2001m1 to 2023m12). It should be cumulative.
Thank you in advance!
Michael

Comment