Hello,
I am trying to generate a new variable that gives for all Years and NA's the value of the IV_Exportshock under NA "AZ" in the Year 2002.
I tried:
but as it can be expected it only gives the value for the year 2007 under NA "AZ" but I would like the newly created variable to display the same value (e.g. AZ Import shock in 2002) in all rows.
Do you have any suggestions on how to adjust the command? Thank you very much in advance!
I am trying to generate a new variable that gives for all Years and NA's the value of the IV_Exportshock under NA "AZ" in the Year 2002.
I tried:
Code:
gen IV_Imortshock_AZ2002 = IV_Importshock if NA=="AZ" & Year==2007
Do you have any suggestions on how to adjust the command? Thank you very much in advance!
Code:
clear input float Year str2 NA float IV_Exportshock 2002 "AZ" . 2007 "AZ" 233546645504 2012 "AZ" -232296038400 2017 "AZ" 28940210176 2002 "C1" . 2007 "C1" 36097335296 2012 "C1" -41467588608 2017 "C1" 329670976 2002 "C2" . 2007 "C2" 154366148608 2012 "C2" 73867247616 2017 "C2" -37996838912 2002 "C3" . 2007 "C3" 11276726272 2012 "C3" 60813754368 2017 "C3" 44920815616 2002 "C4" . 2007 "C4" -31695208448 2012 "C4" 120318328832 2017 "C4" -1.258267e+11 2002 "C5" . 2007 "C5" 18995791872 2012 "C5" -3796148224 2017 "C5" 9838895104 2002 "DE" . 2007 "DE" -9318644736 2012 "DE" 22979246080 2017 "DE" -23000590336 2002 "JZ" . 2007 "JZ" -13804761088 2012 "JZ" -42036465664 2017 "JZ" 74112778240 2002 "MN" . 2007 "MN" 91377008 2012 "MN" 46314561536 2017 "MN" 161840463872 2002 "RU" . 2007 "RU" -2540648960 2012 "RU" 225284472832 2017 "RU" -1.945715e+11 end

Comment