Hello again. I am working on constructing an IV, and have come across a seemingly complex way to formulate the dependent dummy variable that I need. The data I have has to do with currency pegging decisions by countries. A "leader" country is one that many other countries (followers) may decide to peg their currency to. The dummy variable I need to create would = 1 when two follower countries share the same leader. In the below example, both ARG and ECU peg their currencies to the USA. Then, for ARG and ECU, they bilaterally share a common currency leader. See the example below, I would like to create the "common_leader" variable.
Alternatively, I could create separate "peg" variables for the different leader countries, as in the below example:
I suspect this second way of formatting the data would simplify the conditional requirements for generating the dummy variable. I have a tough time figuring out how to construct these complex conditional statements. I have tried my hand at creating the gen statement a few times, but I believe I need to include the client variable, the country variables, and the "peg" variable. I am not even sure if these can all actually work together, and would certainly be open to suggestions for reformatting the data so I can create the common_leader variable. Thank you!
Code:
* Example generated by -dataex-. For more info, type help dataex clear input int year str3(country_exp country_imp) str7 countries str3(leader follower) byte(peg common_leader) 2000 "USA" "ARG" "USA_ARG" "USA" "ARG" 1 0 2000 "ARG" "USA" "ARG_USA" "USA" "ARG" 1 0 2000 "GBR" "CHN" "GBR_CHN" "GBR" "CHN" 0 0 2000 "CHN" "GBR" "CHN_GBR" "GBR" "CHN" 0 0 2000 "USA" "ECU" "USA_ECU" "USA" "ECU" 1 0 2000 "ARG" "ECU" "ARG_ECU" "." "." 0 1 2000 "ECU" "ARG" "ECU_ARG" "." "." 0 1 end
Code:
* Example generated by -dataex-. For more info, type help dataex clear input int year str3(country_exp country_imp) str7 countries str3(leader follower) byte(peg_USA peg_GBR common_leader) 2000 "USA" "ARG" "USA_ARG" "USA" "ARG" 1 0 0 2000 "ARG" "USA" "ARG_USA" "USA" "ARG" 1 0 0 2000 "GBR" "CHN" "GBR_CHN" "GBR" "CHN" 0 0 0 2000 "CHN" "GBR" "CHN_GBR" "GBR" "CHN" 0 0 0 2000 "USA" "ECU" "USA_ECU" "USA" "ECU" 1 0 0 2000 "ARG" "ECU" "ARG_ECU" "." "." 0 0 1 2000 "ECU" "ARG" "ECU_ARG" "." "." 0 0 1 end

Comment