I am currently working on a dataset (tradedata from 2004--2016) where I have created a dummy-variable called "Crisis". I want this variable to represent the global financial crisis of 2008 and therefore I have definied it as a dummy based on time, so that year 2008 and 2009 takes on a value of 1 (and all other years takes on a value of 0). However, my teacher critized me for defining it this way and suggested that I would define it based on a drop in GDP. How do I perform this in stata? I.e. how do I create a dummy variable that takes on the value of 1 when GDP drops below a certain percentage? (for example). If you have any better suggestions on how to create the variable I would be beyond grateful!
When I defined "Crisis" based on Year, it was fairly easy to this in Stata, where I used this code:
Code:
gen Crisis=0 replace Crisis=1 if Year==2008 replace Crisis=1 if Year==2009
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str15 Importer str30 Exporter double Imports int Year double(GDPimporter GDPexporter) byte Crisis "France" "United Arab Emirates" 648410.85 2004 2115742488204.619 147824370319.94556 0 "Portugal" "Qatar" 20200.001 2004 189187437298.2369 31734065934.065933 0 "Italy" "Turkey" 4933186.063 2004 1798314750434.5667 404786740091.19604 0 "Sweden" "Croatia" 129844.593 2004 381705425301.7458 41574530815.5047 0 "Germany" "Honduras" 114180 2004 2819245095604.6685 8772194250.270214 0 "United Kingdom" "Seychelles" 107903.697 2004 2398555474185.2803 839319927.2727273 0 "Belgium" "Guatemala" 16508.368 2004 370885026074.0005 23965275995.721386 0 "Denmark" "Jamaica" 281.633 2004 251373036671.06207 10150978154.548418 0 "Hungary" "Grenada" 10 2004 104066609517.92836 599118592.5925926 0 "Poland" "Grenada" 20.445 2004 255102252843.3946 599118592.5925926 0 "Cyprus" "Guatemala" 111.9 2004 17422375000 23965275995.721386 0 "Finland" "Madagascar" 120.726 2004 196768065557.48697 4363934494.37405 0 "United Kingdom" "Argentina" 565319.435 2004 2398555474185.2803 164657930452.78662 0 "Estonia" "Bermuda" 2401.643 2004 12059201242.236025 4484703000 0 "Denmark" "Cayman Islands" 544.001 2004 251373036671.06207 . 0 "United Kingdom" "Ghana" 373534.056 2004 2398555474185.2803 8881368538.07671 0 "Ireland" "Niger" 1830.913 2004 193870350136.5781 3052898739.467802 0 "Portugal" "Turkey" 438144.182 2004 189187437298.2369 404786740091.19604 0 "Luxembourg" "Albania" 1.843 2004 34685281847.529175 7314865175.619896 0 "Cyprus" "Sierra Leone" 69.88 2004 17422375000 1448536630.8917043 0 "France" "Aruba" 114299.367 2004 2115742488204.619 2228279329.6089387 0 "France" "Uganda" 40355.88 2004 2115742488204.619 7940362799.179966 0 "Netherlands" "United Arab Emirates" 552146.414 2004 650532654581.5743 147824370319.94556 0 "France" "Korea, Rep." 3896355.152 2004 2115742488204.619 764880644710.6486 0 "Ireland" "Guatemala" 678.881 2004 193870350136.5781 23965275995.721386 0 "Portugal" "Marshall Islands" 13.092 2004 189187437298.2369 131334599.99999999 0 "Lithuania" "Israel" 8566.473 2004 22649930576.254345 135445033199.46452 0 "Latvia" "Burma" 44.896 2004 14373269155.717443 10567354056.404905 0 "France" "Kenya" 104704.863 2004 2115742488204.619 16095337093.836601 0 "Greece" "Cape Verde" 4.202 2004 240521260988.32877 924318490.7598001 0 "Finland" "Suriname" 40.744 2004 196768065557.48697 1484092538.4052672 0 "Denmark" "Micronesia, Fed. Sts." .451 2004 251373036671.06207 240097000 0 "Spain" "United Arab Emirates" 114508.018 2004 1069555500372.4857 147824370319.94556 0 "Greece" "Panama" 36830.984 2004 240521260988.32877 15013381700 0 "Sweden" "Grenada" 2.865 2004 381705425301.7458 599118592.5925926 0 "France" "Armenia" 2418.218 2004 2115742488204.619 3576615240.41616 0 "Belgium" "Singapore" 576391.156 2004 370885026074.0005 114188557567.15183 0 "Luxembourg" "Russian Federation" 10377.366 2004 34685281847.529175 591016690742.7976 0 "Germany" "Namibia" 56809 2004 2819245095604.6685 6606858786.011735 0 "Cyprus" "Lao PDR" 10.788 2004 17422375000 2366398119.882102 0 "France" "Chad" 8635.427 2004 2115742488204.619 4414929219.996487 0 "Cyprus" "Sri Lanka" 3340.98 2004 17422375000 20662525941.29855 0 "France" "Macao" 129318.691 2004 2115742488204.619 10585624890.927675 0 "Slovenia" "Lebanon" 90.002 2004 34470227453.911316 20955223880.59701 0 "Slovak Republic" "Micronesia, Fed. Sts." 2.894 2004 57240535137.81972 240097000 0 "United Kingdom" "Lebanon" 23348.289 2004 2398555474185.2803 20955223880.59701 0 "Poland" "United States of America" 2119431.616 2004 255102252843.3946 1.2274928e+13 0 "Ireland" "St. Lucia" 302.161 2004 193870350136.5781 893107210.7888889 0 "Slovenia" "Japan" 243779.972 2004 34470227453.911316 4815148854362.112 0 "Slovenia" "Dominican Republic" 542.206 2004 34470227453.911316 22692574473.346703 0 "Sweden" "El Salvador" 1152.92 2004 381705425301.7458 13724810900 0 "Belgium" "Macedonia, FYR" 33987.668 2004 370885026074.0005 5682719260.0763 0 "Slovak Republic" "Burkina Faso" 51.43 2004 57240535137.81972 4838551099.709853 0 "Germany" "Algeria" 1027560 2004 2819245095604.6685 85324998813.60402 0 "Hungary" "Antigua and Barbuda" 84 2004 104066609517.92836 919577148.1481481 0 "Greece" "Senegal" 23358.596 2004 240521260988.32877 8031344381.098982 0 "Slovenia" "China" 478261.592 2004 34470227453.911316 1955347004963.2708 0 "Poland" "El Salvador" 1705.208 2004 255102252843.3946 13724810900 0 "Italy" "Sao Tome and Principe" 230.504 2004 1798314750434.5667 104486043.47856033 0 "Germany" "Georgia" 27725 2004 2819245095604.6685 5125363000.834724 0 "France" "Central African Republic" 10816.053 2004 2115742488204.619 1270080250.6526783 0 "Slovak Republic" "United States of America" 473561.68 2004 57240535137.81972 1.2274928e+13 0 "Hungary" "Marshall Islands" 899 2004 104066609517.92836 131334599.99999999 0 "Germany" "United States of America" 50013340 2004 2819245095604.6685 1.2274928e+13 0 "Netherlands" "Liberia" 5767.585 2004 650532654581.5743 474699999.99999994 0 "France" "Botswana" 4662.285 2004 2115742488204.619 8957467706.535404 0 "Slovak Republic" "Indonesia" 110238.41 2004 57240535137.81972 256836875295.4519 0 "Germany" "Sri Lanka" 315858 2004 2819245095604.6685 20662525941.29855 0 "Greece" "Georgia" 55843.759 2004 240521260988.32877 5125363000.834724 0 "Netherlands" "Turkmenistan" 23.643 2004 650532654581.5743 6838351088.466884 0 "France" "Burkina Faso" 9099.416 2004 2115742488204.619 4838551099.709853 0 "Ireland" "Argentina" 48110.391 2004 193870350136.5781 164657930452.78662 0 "Italy" "Canada" 1669866.099 2004 1798314750434.5667 1023196003074.5581 0 "Netherlands" "Qatar" 6147.113 2004 650532654581.5743 31734065934.065933 0 "Slovak Republic" "Japan" 583910.219 2004 57240535137.81972 4815148854362.112 0 "Hungary" "Burma" 127 2004 104066609517.92836 10567354056.404905 0 "Slovak Republic" "Maldives" 1.2 2004 57240535137.81972 1226829562.5 0 "United Kingdom" "El Salvador" 13337.098 2004 2398555474185.2803 13724810900 0 "Italy" "Angola" 35355.777 2004 1798314750434.5667 19640853733.597954 0 "Greece" "Fiji" .124 2004 240521260988.32877 2727507212.925563 0 "Denmark" "Indonesia" 171495.119 2004 251373036671.06207 256836875295.4519 0 "Cyprus" "Comoros" .03 2004 17422375000 368143118.6899598 0 "France" "Trinidad and Tobago" 299136.315 2004 2115742488204.619 13280275123.035402 0 "Malta" "Sierra Leone" .029 2004 6062780269.058296 1448536630.8917043 0 "Cyprus" "Jordan" 2601.052 2004 17422375000 11411390409.026798 0 "Greece" "Cayman Islands" 4399.51 2004 240521260988.32877 . 0 "Ireland" "Mongolia" 4.844 2004 193870350136.5781 1992066808.0959773 0 "Finland" "Iceland" 14637.984 2004 196768065557.48697 13722824251.300367 0 "Luxembourg" "Algeria" 214.85 2004 34685281847.529175 85324998813.60402 0 "Czech Republic" "India" 179433.013 2004 119162172468.26823 699688852930.2765 0 "Denmark" "Cape Verde" 580.211 2004 251373036671.06207 924318490.7598001 0 "United Kingdom" "Equatorial Guinea" 24050.36 2004 2398555474185.2803 4410764338.667325 0 "Hungary" "C�te d'Ivoire" 4053 2004 104066609517.92836 16554441846.51915 0 "Lithuania" "Uruguay" 1447.599 2004 22649930576.254345 13686329890.119078 0 "France" "Cayman Islands" 9186.492 2004 2115742488204.619 . 0 "Netherlands" "Albania" 2898.103 2004 650532654581.5743 7314865175.619896 0 "Latvia" "Lebanon" 68.513 2004 14373269155.717443 20955223880.59701 0 "Austria" "Burkina Faso" 393.007 2004 300904221504.8423 4838551099.709853 0 "Netherlands" "Philippines" 2643034.758 2004 650532654581.5743 91371242495.85616 0 "Greece" "Armenia" 813.247 2004 240521260988.32877 3576615240.41616 0 end
Gabriel Bladh
0 Response to I need help to create a variable
Post a Comment