Good day
I am conducting research on the effects of energy poverty on human development outcomes in South Africa. I am using a panel dataset: all five waves of the National Income Dynamics Survey (South Africa).
As pointed out by literature, electricity tariff/ price may serve as an appropriate instrumental variable for energy poverty.
NIDS has information on electricity expenditure, but not on price.
I have had to compile my own dataset on South Africa's average electricity price for the wave year by local district. I successfully did so and imported the excel sheet into Stata to create a dataset.
My issue comes into play now: I want to merge the electricity price data with the NIDS panel so that each district has the price of electricity for that year.
Here is an example of the code that I have tried to use to make a unique district-wave identifier (having also done it manually):
However, Stata gives the following error message:
I am really struggling to find any resources that point to an adequate way to achieve this. Your help would be greatly appreciated.
Here is an example of the dataset(s):
NIDS:
ELECTRICITY TARIFF DATA:
I am conducting research on the effects of energy poverty on human development outcomes in South Africa. I am using a panel dataset: all five waves of the National Income Dynamics Survey (South Africa).
As pointed out by literature, electricity tariff/ price may serve as an appropriate instrumental variable for energy poverty.
NIDS has information on electricity expenditure, but not on price.
I have had to compile my own dataset on South Africa's average electricity price for the wave year by local district. I successfully did so and imported the excel sheet into Stata to create a dataset.
My issue comes into play now: I want to merge the electricity price data with the NIDS panel so that each district has the price of electricity for that year.
Here is an example of the code that I have tried to use to make a unique district-wave identifier (having also done it manually):
Code:
egen dis_wave = concat(district wave)
Code:
merge 1:1 dis_wave using "NERSA_33.dta", force
variable dis_wave does not uniquely identify observations in the master data
Here is an example of the dataset(s):
NIDS:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long(pid hhid) int district byte wave str4 dis_wave 410155 210164 24 2 "242" 313284 214163 24 2 "242" 408391 511458 24 5 "245" 317120 502738 26 5 "265" 320846 301950 275 3 "2753" 492603 502472 38 5 "385" 381096 300138 44 3 "443" 412211 410930 6 4 "64" 310042 121566 774 1 "7741" 403343 113033 83 1 "831" end label values district w5_dc2001 label def w5_dc2001 6 "6. Namakwa District Municipality", modify label def w5_dc2001 24 "24. Umzinyathi District Municipality", modify label def w5_dc2001 26 "26. Zululand District Municipality", modify label def w5_dc2001 38 "38. Central District Municipality", modify label def w5_dc2001 44 "44. Alfred Nzo District Municipality", modify label def w5_dc2001 83 "83. Sekhukhune Cross Boundary District Municipality", modify label def w5_dc2001 275 "275. Nelson Mandela Metropolitan Municipality", modify label def w5_dc2001 774 "774. City Of Johannesburg Metropolitan Municipality", modify label values wave WA label def WA 1 "wave 1", modify label def WA 2 "wave 2", modify label def WA 3 "wave 3", modify label def WA 4 "wave 4", modify label def WA 5 "wave 5", modify
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long(pid hhid) int district byte wave str4 dis_wave 410155 210164 24 2 "242" 313284 214163 24 2 "242" 408391 511458 24 5 "245" 317120 502738 26 5 "265" 320846 301950 275 3 "2753" 492603 502472 38 5 "385" 381096 300138 44 3 "443" 412211 410930 6 4 "64" 310042 121566 774 1 "7741" 403343 113033 83 1 "831" end label values district w5_dc2001 label def w5_dc2001 6 "6. Namakwa District Municipality", modify label def w5_dc2001 24 "24. Umzinyathi District Municipality", modify label def w5_dc2001 26 "26. Zululand District Municipality", modify label def w5_dc2001 38 "38. Central District Municipality", modify label def w5_dc2001 44 "44. Alfred Nzo District Municipality", modify label def w5_dc2001 83 "83. Sekhukhune Cross Boundary District Municipality", modify label def w5_dc2001 275 "275. Nelson Mandela Metropolitan Municipality", modify label def w5_dc2001 774 "774. City Of Johannesburg Metropolitan Municipality", modify label values wave WA label def WA 1 "wave 1", modify label def WA 2 "wave 2", modify label def WA 3 "wave 3", modify label def WA 4 "wave 4", modify label def WA 5 "wave 5", modify
Comment