10.07.2015 Views

MRU3a

MRU3a

MRU3a

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

name: log: /Users/cfbaum/Downloads/gravity/<strong>MRU3a</strong>.smcllog type: smclopened on: 2 Jan 2013, 13:53:061 . clear all2 . // file from JE Anderson, Gravity with Gravitas archive on www2.bc.edu/~anderson3 . insheet using dist22.txt(23 vars, 32 obs)4 . keep in 1/22(10 observations deleted)5 . tomata v2-v236 . mata:mata (type end to exit): // move US to first position: dist = v2,v3,v4,v5,v6,v7,v8,v9,v10,v11,v12,v13,v14,v15,v16,v17,v18,v19,v20,v21,v22,v23: // c=(0,a[4,1::3])\(a[4,1::3]',b): dist2 = (0,dist[22,1::21])\(dist[22,1::21]',dist[1..21,1..21]): xp = ("USA", "Canada", "Australia", "Japan", "New Zealand", "Austria", "Belgium", "Denmark", "Finland", "F> rance", "Germany", "Greece", "Iceland", "Ireland", "Italy", "Netherlands", "Norway", "Portugal", "Spain",> "Sweden", "Switzerland", "UK")': st_matrix("dij", vec(dist2)): end7 . tomata v18 . mata:: v1r = v1[22]\v1[1::21]mata (type end to exit): st_matrix("GDPm", v1r): v1w = v1r :* J(22, 22, 1): st_matrix("GDPx", vec(v1w)): endWednesday, January 2, 2013 1:53 PM Page 1


9 . drop v1-v2310 . set obs 22 // `=22*22'obs was 0, now 2211 . g str12 impt = ""(22 missing values generated)12 . mata:: st_sview(imp=., ., "impt")mata (type end to exit): imp[.,.] = xp: end13 . svmat GDPm14 . rename GDPm1 GDPm15 . g en = _n16 . expand 22(462 observations created)17 . sort en18 . drop en19 . g str12 expt = " "20 . mata:: st_sview(xxp=., ., "expt")mata (type end to exit): xxp[.,.] = xp\xp\xp\xp\xp\xp\xp\xp\xp\xp\xp\xp\xp\xp\xp\xp\xp\xp\xp\xp\xp\xp: end21 . order expt impt22 .23 . svmat GDPxWednesday, January 2, 2013 1:53 PM Page 2


24 . rename GDPx1 GDPx25 . svmat dij26 . rename dij1 dij27 . descContains dataobs: 484vars: 5size: 17,424storage display valuevariable name type format label variable labelexpt str12 %12simpt str12 %12sGDPmfloat %9.0gGDPxfloat %9.0gdijfloat %9.0gSorted by:Note: dataset has changed since last saved28 . suVariable Obs Mean Std. Dev. Min Maxexpt 0impt 0GDPm 484 861.7318 1553.383 6.1 6558.1GDPx 484 861.7318 1553.383 6.1 6558.1dij 484 3248.308 3623.098 0 1233829 . save grav1, replacefile grav1.dta saved30 .31 . mata:mata clear32 . clear all33 . // OECD exports, US as first country rather than last34 . // row = importer, col = exporter35 . insheet using OECDtrade1.txt(22 vars, 22 obs)Wednesday, January 2, 2013 1:53 PM Page 3


36 . tomata v1-v2237 . set obs `=22*22'obs was 22, now 48438 . mata:mata (type end to exit): voltr = v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11,v12,v13,v14,v15,v16,v17,v18,v19,v20,v21,v22: voltr1 2 3 4 5 61 0 113617 3542.800049 110418 1325.5 1467.4000242 87758.89844 0 821.6199951 8250.959961 197.2200012 373.26000983 9134 704.1900024 0 8085.669922 2067.840088 155.19999694 55943.10156 8148.310059 12252.7998 0 1761.01001 692.86999515 1736.26001 154.5599976 2060.159912 1563.5 0 24.979999546 2147.070068 186.0599976 24.98999977 2136.379883 29.38999939 07 6035.390137 461.3900146 296.8099976 3203.939941 96.51999664 744.54998788 1417.150024 130.0200043 39.61999893 1022.52002 24.87999916 350.61999519 1307.719971 124.9499969 75.23000336 1041.420044 10.10999966 205.630004910 17606.40039 1192.699951 593.4199829 8295.30957 161.3300018 1811.79003911 24235.59961 2397.679932 977.8499756 20655 362.8800049 17476.8007812 821.6900024 61.75999832 14.21000004 1500.640015 27.82999992 231.860000613 126.0699997 8.390000343 32.58000183 74.84999847 .9900000095 11.0600004214 3744.090088 119.1299973 20.61000061 1430.780029 14.05000019 90.9300003115 7873.660156 1215.569946 751.6099854 3819.199951 141.1999969 3273.20996116 9898.580078 669.4799805 368.5100098 4590.220215 52.11000061 1088.94995117 1884.170044 484.7999878 88 1264.97998 6.590000153 255.259994518 765.0499878 100.0899963 30.51000023 779.4099731 12.60999966 200.600006119 5624.919922 392.7200012 228.8200073 3188.610107 54.97999954 835.229980520 3752.850098 235.0299988 127.3199997 2115.590088 29.28000069 575.729980521 3927.340088 205.8099976 79.80999756 2350.419922 41.75999832 2478.2700222 24641.69922 2785.570068 1499.48999 12785.09961 746.9299927 1456.239997 8 9 10 11 121 5599 1740.5 1720.400024 15694 29461.59961 373.60000612 410.9100037 182.2899933 198.0200043 1715.140015 2710.669922 44.650001533 351.0299988 198.5899963 308.5 1003.440002 2449.850098 35.150001534 1403.880005 1562.339966 428.1700134 5148.299805 9824.339844 96.660003665 74.02999878 45.20999908 45.45999908 162.8399963 419.8599854 3.9100000866 1389.939941 390.1199951 311.8800049 2156.550049 20172.30078 189.257 0 683.039978 541.2999878 17875.19922 23816.90039 147.16999828 1061.27002 0 845.7299805 1553.22998 6685.810059 51.200000769 520.8900146 563.9099731 0 825.8699951 2934.800049 48.7299995410 18190 1822.349976 1340.969971 0 35790.5 480.239990211 18862.09961 5901.759766 3412.570068 36991.69922 0 1855.512 630.5 256.3500061 138.0700073 1407.900024 3280.280029 013 26.13999939 126.6699982 26.64999962 45.97999954 160.9499969 1.94000005714 333.1799927 166.4799957 136.0800018 856.1799927 1585.560059 16.7999992415 6864.669922 1515.349976 889.289978 20100 28527.09961 1120.16003416 12344.90039 1328.550049 1195.160034 7974.02002 25063.59961 216.419998217 586.4699707 1727.040039 788.6599731 983.7600098 3200.610107 40.9599990818 913.7800293 184.3500061 157.1900024 3071.149902 3627.659912 27.2600002319 2887.149902 720.3400269 696.6500244 13949.7002 12864.90039 202.520 1489.199951 3607 2626.48999 2253.129883 7578.669922 89.2300033621 2185.310059 678.6799927 371.1799927 6646.930176 19781.80078 83.66999817Wednesday, January 2, 2013 1:53 PM Page 4


39 . drop v1-v2240 . svmat voltrnumber of observations will be reset to 484Press any key to continue, or Break to abortobs was 0, now 48441 . rename voltr1 voltr42 . merge 1:1 _n using grav1Result# of obs.not matched 0matched484 (_merge==3)43 . order expt impt voltr GDPx GDPm dij44 . drop _merge45 . lab data "OECD trade data from JE Anderson, Gravity with Gravitas data archive"46 . // must Stat/Transfer to Stata 10 format47 . save grav1, replacefile grav1.dta saved48 . log closename: log: /Users/cfbaum/Downloads/gravity/<strong>MRU3a</strong>.smcllog type: smclclosed on: 2 Jan 2013, 13:53:06Wednesday, January 2, 2013 1:53 PM Page 6

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!