Hey folks,
I was wondering why Stata doesn't show a graph for two countries of my dataset while two other countries work. Hope some of you more experienced stata users can help me.
This is my do-file:
Dataex:
this is how the graph looks at the moment..
Thanks in advance
Nico
I was wondering why Stata doesn't show a graph for two countries of my dataset while two other countries work. Hope some of you more experienced stata users can help me.
This is my do-file:
Code:
import excel "/Users/nicolasstappen/Desktop/Nico/Studium/Master/5. Semester/Masterarbeit/Daten/Stata analyse /vollständige Daten 29.11.xlsx", sheet("FDI Flows") firstrow case(lower) codebook drop indicator // no information and/or variation drop measure // no information and/or variation replace location="belgium" if location=="BEL" replace location="france" if location=="FRA" replace location="germany" if location=="DEU" replace location="ireland" if location=="IRL" replace location="italy" if location=="ITA" replace location="netherlands" if location=="NLD" replace location="poland" if location=="POL" replace location="spain" if location=="ESP" replace location="sweden" if location=="SWE" replace location="united kingdom" if location=="GBR" replace location="european union" if location=="EU" replace location="australia" if location=="AUS" replace location="canada" if location=="CAN" replace location="japan" if location=="JPN" replace location="norway" if location=="NOR" replace location="switzerland" if location=="CHE" replace location="turkey" if location=="TUR" replace location="usa" if location=="USA" replace location="china" if location=="CHN" replace location="india" if location=="IND" replace period="201703" if time=="2017-Q3" replace period="201704" if time=="2017-Q4" replace period="201801" if time=="2018-Q1" replace period="201802" if time=="2018-Q2" replace period="201803" if time=="2018-Q3" replace period="201804" if time=="2018-Q4" replace period="201901" if time=="2019-Q1" replace period="201902" if time=="2019-Q2" replace period="201903" if time=="2019-Q3" replace period="201904" if time=="2019-Q4" replace period="202001" if time=="2020-Q1" replace period="202002" if time=="2020-Q2" replace period="202003" if time=="2020-Q3" replace period="202004" if time=="2020-Q4" replace period="202101" if time=="2021-Q1" replace period="202102" if time=="2021-Q2" replace period="202103" if time=="2021-Q3" replace period="202104" if time=="2021-Q4" replace period="202201" if time=="2022-Q1" replace period="202202" if time=="2022-Q2" destring period, replace gen q=0 replace q=1 if time=="2018-Q1" | time=="2019-Q1" | time=="2020-Q1" | time=="2021-Q1" | time=="2022-Q1" replace q=2 if time=="2018-Q2" | time=="2019-Q2" | time=="2020-Q2" | time=="2021-Q2" | time=="2022-Q2" replace q=3 if time=="2017-Q3" | time=="2018-Q3" | time=="2019-Q3" | time=="2020-Q3" | time=="2021-Q3" replace q=4 if time=="2017-Q4" | time=="2018-Q4" | time=="2019-Q4" | time=="2020-Q4" | time=="2021-Q4" gen fdibalance = inwardvalues - outwardvalues xtset inwardvalues xtset outwardvalues gen zeit = yq(floor(period/100), mod(period, 100)) format zeit %tq //sort partner sort zeit format %30.0g inwardvalues // um e's wegzubekommen format %30.0g outwardvalues // um e's wegzubekommen #delimit ; graph twoway (line inwardvalues zeit if location=="netherlands", c(L)) || (line outwardvalues zeit if location=="netherlands", c(L)) , xline(240.33) xlabel(, angle(45)) ylabel(, angle(45)) legend(label(1 "Inwards") label(2 "Outwards")) title("Netherlands FDI") scheme(s2color) name(netherlands, replace) ; #delimit cr #delimit ; graph twoway (line inwardvalues zeit if location=="poland", c(L)) || (line outwardvalues zeit if location=="poland", c(L)) , xline(240.33) xlabel(, angle(45)) ylabel(, angle(45)) legend(label(1 "Inwards") label(2 "Outwards")) title("Poland FDI") scheme(s2color) name(poland, replace) ; #delimit cr #delimit ; graph twoway (line inwardvalues zeit if location=="united kingdom", c(L)) || (line outwardvalues zeit if location=="united kingdom", c(L)) , xline(240.33) xlabel(, angle(45)) ylabel(, angle(45)) legend(label(1 "Inwards") label(2 "Outwards")) title("UK FDI") scheme(s2color) name(UK, replace) ; #delimit cr #delimit ; graph twoway (line inwardvalues zeit if location=="european union", c(L)) || (line outwardvalues zeit if location=="european union", c(L)) , xline(240.33) xlabel(, angle(45)) ylabel(, angle(45)) legend(label(1 "Inwards") label(2 "Outwards")) title("EU FDI") scheme(s2color) name(EU, replace) ; #delimit cr
Dataex:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str11 location str7 time double(inwardvalues outwardvalues) long period float(q fdibalance zeit) "sweden" "2017-Q3" 1798.5257985258 9617.0586170586 201703 3 -7818.533 230 "poland" "2017-Q3" 3651.2914197841 105.93156690124 201703 3 3545.36 230 "france" "2017-Q3" 6647.8081852108 20934.100886371 201703 3 -14286.293 230 "ireland" "2017-Q3" 2166.6103032353 9480.3291624394 201703 3 -7313.719 230 "turkey" "2017-Q3" 2837.66 103.76 201703 3 2733.9 230 "japan" "2017-Q3" 3444.6300192453 34193.216473132 201703 3 -30748.586 230 "china" "2017-Q3" 32645 32596.3 201703 3 48.7 230 "switzerland" "2017-Q3" -7321.5775547993 -6810.7043104588 201703 3 -510.8732 230 "india" "2017-Q3" 14691.92261 2280.547206 201703 3 12411.375 230 "spain" "2017-Q3" 1951.3019952655 10909.705782888 201703 3 -8958.403 230 "canada" "2017-Q3" 7543.6612576843 13012.157844773 201703 3 -5468.497 230 "netherlands" "2017-Q3" 43628.738364333 27279.961450795 201703 3 16348.777 230 "italy" "2017-Q3" 5475.1324540638 6084.3873295006 201703 3 -609.2549 230 "usa" "2017-Q3" 74236 110175 201703 3 -35939 230 "germany" "2017-Q3" 16086.990192763 11250.36974411 201703 3 4836.6206 230 "belgium" "2017-Q3" 5946.3420133018 20462.180137527 201703 3 -14515.838 230 "netherlands" "2017-Q4" -40078.499250366 -13754.522233119 201704 4 -26323.977 231 "spain" "2017-Q4" 28446.623830459 30857.851425995 201704 4 -2411.2275 231 "canada" "2017-Q4" 6007.3869425314 13822.395664972 201704 4 -7815.009 231 "usa" "2017-Q4" 69702 38535 201704 4 31167 231 "turkey" "2017-Q4" 3274.16 819.41 201704 4 2454.75 231 "china" "2017-Q4" 79284.3 46332.2 201704 4 32952.1 231 "germany" "2017-Q4" 10823.343478751 18154.920527562 201704 4 -7331.577 231 "india" "2017-Q4" 5985.412089 1662.071754 201704 4 4323.3403 231 "switzerland" "2017-Q4" 20579.150094961 -4137.1291453489 201704 4 24716.28 231 "belgium" "2017-Q4" 8678.8411678503 23722.241010033 201704 4 -15043.4 231 "poland" "2017-Q4" 3186.8013797764 -228.7430551718 201704 4 3415.5444 231 "ireland" "2017-Q4" -30592.943298388 -65976.778266261 201704 4 35383.836 231 "japan" "2017-Q4" 2508.668551395 35605.948190137 201704 4 -33097.28 231 "sweden" "2017-Q4" 1426.1144261144 3988.767988768 201704 4 -2562.6536 231 "italy" "2017-Q4" 6421.2907225792 10640.858978695 201704 4 -4219.5684 231 "france" "2017-Q4" -1825.745928518 5232.3889339131 201704 4 -7058.135 231 "belgium" "2018-Q1" 907.58881151894 14356.190251387 201801 1 -13448.602 232 "germany" "2018-Q1" 11192.748731264 44485.906998702 201801 1 -33293.16 232 "sweden" "2018-Q1" -2192.8794992175 5899.0380189635 201801 1 -8091.917 232 "poland" "2018-Q1" 7047.6532086858 2041.9611939546 201801 1 5005.692 232 "india" "2018-Q1" 8605.117409 2197.543327 201801 1 6407.574 232 "netherlands" "2018-Q1" 23112.529128998 43489.019180928 201801 1 -20376.49 232 "canada" "2018-Q1" 11560.019857264 7479.4560969833 201801 1 4080.564 232 "china" "2018-Q1" 81979.3 30306.1 201801 1 51673.2 232 "france" "2018-Q1" 3007.4536656135 43742.86598093 201801 1 -40735.41 232 "ireland" "2018-Q1" -21138.911837602 -1399.7403517054 201801 1 -19739.17 232 "usa" "2018-Q1" 33819 -43887 201801 1 77706 232 "japan" "2018-Q1" 5203.3678993424 37951.914705961 201801 1 -32748.547 232 "switzerland" "2018-Q1" -58700.463264238 -7624.2664731052 201801 1 -51076.2 232 "italy" "2018-Q1" 6706.9774578072 9318.8457453086 201801 1 -2611.8684 232 "spain" "2018-Q1" 11081.081081081 5692.1987489673 201801 1 5388.882 232 "turkey" "2018-Q1" 2228.15 1145.31 201801 1 1082.84 232 "germany" "2018-Q2" 7341.7892127936 57332.75935324 201802 2 -49990.97 233 "usa" "2018-Q2" -5428 -60833 201802 2 55405 233 "belgium" "2018-Q2" -10154.608757229 -14595.774814115 201802 2 4441.166 233 "india" "2018-Q2" 13126.07 3554 201802 2 9572.07 233 "italy" "2018-Q2" 5084.9439395728 9822.3592588221 201802 2 -4737.4155 233 "netherlands" "2018-Q2" 18469.509953971 7119.3388422047 201802 2 11350.17 233 "spain" "2018-Q2" 30088.516464062 10972.500885165 201802 2 19116.016 233 "china" "2018-Q2" 61669.5 40238.2 201802 2 21431.3 233 "france" "2018-Q2" 8517.6902596374 12982.812017323 201802 2 -4465.1216 233 "poland" "2018-Q2" 1873.2530485838 -1329.5643956206 201802 2 3202.8174 233 "japan" "2018-Q2" 2843.6623197039 34804.897077079 201802 2 -31961.234 233 "ireland" "2018-Q2" -51736.102915142 -41439.867815414 201802 2 -10296.235 233 "canada" "2018-Q2" 6298.1813863899 14920.564971144 201802 2 -8622.384 233 "sweden" "2018-Q2" 249.93095829881 -3820.1923962073 201802 2 4070.123 233 "switzerland" "2018-Q2" -8804.0923243489 25719.942758674 201802 2 -34524.035 233 "turkey" "2018-Q2" 2872.15 936.77 201802 2 1935.38 233 "italy" "2018-Q3" 6593.0414257052 3643.0201817538 201803 3 2950.021 234 "india" "2018-Q3" 10020.76 2610 201803 3 7410.76 234 "poland" "2018-Q3" 6185.1136441854 473.34709824752 201803 3 5711.767 234 "switzerland" "2018-Q3" -37188.077295439 3514.7359918542 201803 3 -40702.81 234 "belgium" "2018-Q3" 9248.2001652307 6498.2886816948 201803 3 2749.9114 234 "sweden" "2018-Q3" 7045.2453281782 3902.6972291264 201803 3 3142.548 234 "turkey" "2018-Q3" 3122.14 725.81 201803 3 2396.33 234 "germany" "2018-Q3" 4087.2583500531 12948.211967426 201803 3 -8860.954 234 "japan" "2018-Q3" 1088.7457081362 34341.420759188 201803 3 -33252.676 234 "china" "2018-Q3" 34234.3 36017.7 201803 3 -1783.4 234 "netherlands" "2018-Q3" -6077.3839088871 -19644.007307919 201803 3 13566.623 234 "usa" "2018-Q3" 107366 56040 201803 3 51326 234 "france" "2018-Q3" 3152.1575981622 17977.034064832 201803 3 -14824.877 234 "spain" "2018-Q3" 21418.623864039 18777.292576419 201803 3 2641.331 234 "ireland" "2018-Q3" -10752.98005429 3006.0191195562 201803 3 -13759 234 "canada" "2018-Q3" 9387.3686779569 22527.15680125 201803 3 -13139.788 234 "france" "2018-Q4" 27129.253828945 27275.468721792 201804 4 -146.21489 235 "poland" "2018-Q4" 1270.2681314037 53.739135723182 201804 4 1216.529 235 "canada" "2018-Q4" 10407.95073914 13109.104426742 201804 4 -2701.154 235 "switzerland" "2018-Q4" 8980.4511276125 38677.009282561 201804 4 -29696.56 235 "netherlands" "2018-Q4" 63814.744962823 -77839.922799481 201804 4 141654.67 235 "spain" "2018-Q4" -5161.0999645934 2080.7270152248 201804 4 -7241.827 235 "germany" "2018-Q4" 49431.272276643 -17594.405759471 201804 4 67025.68 235 "belgium" "2018-Q4" 27117.903930131 37296.117077776 201804 4 -10178.213 235 "india" "2018-Q4" 10365.5 3056 201804 4 7309.5 235 "italy" "2018-Q4" 19273.748377198 8738.4326684763 201804 4 10535.315 235 "japan" "2018-Q4" 1616.4624045481 38480.842581037 201804 4 -36864.38 235 "usa" "2018-Q4" 80658 -80340 201804 4 160998 235 "sweden" "2018-Q4" -1295.5675227838 11852.273773359 201804 4 -13147.84 235 "china" "2018-Q4" 57482 36464.6 201804 4 21017.4 235 "turkey" "2018-Q4" 4312.76 846.68 201804 4 3466.08 235 "ireland" "2018-Q4" 71116.487666706 44146.111176679 201804 4 26970.377 235 "belgium" "2019-Q1" -7522.6687562969 7324.5270345908 201901 1 -14847.195 236 "usa" "2019-Q1" 67787 -27132 201901 1 94919 236 "spain" "2019-Q1" 10135.452815404 7882.0105227807 201901 1 2253.4424 236 "netherlands" "2019-Q1" 4969.7695197582 14457.063849771 201901 1 -9487.294 236 end format %tq zeit
Nico
Comment