Hi all,

I am looking to create the following ratio t_ij= Xii*Xjj / Xij*Xji in STATA, where Xij is the amount of trade flows from country i to partner country j.
Basically, what I want is to produce the above ratio for every country pair and by years.
Taking for example in 1986 and country pair EGY FRA, thus t_(EGY,FRA)= t_(FRA,EGY)=(21513.73*331483.529) / (64.21 * 712.93)
kindly find below a sample of my dataset (using dataex).
Thank you so much.

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str3(exporter importer) float year double trade
"EGY" "EGY" 1986 21513.732490437775
"EGY" "FRA" 1986  64.21695140701533
"EGY" "JOR" 1986  8.102257941186428
"EGY" "USA" 1986  36.60202864223719
"FRA" "EGY" 1986  712.9363456668854
"FRA" "FRA" 1986  331483.5292166333
"FRA" "JOR" 1986   87.8217879538536
"FRA" "USA" 1986  8971.946022914886
"JOR" "EGY" 1986 12.781617261639118
"JOR" "FRA" 1986 12.256044158697128
"JOR" "JOR" 1986  4103.510239855207
"JOR" "USA" 1986  5.215929063171148
"USA" "EGY" 1986  856.1221194445491
"USA" "FRA" 1986  7209.906632585526
"USA" "JOR" 1986 161.66331162691117
"USA" "USA" 1986 2095390.4279831976
"EGY" "EGY" 2006 25694.889538964944
"EGY" "FRA" 2006  549.1717557053418
"EGY" "JOR" 2006 168.16246060848235
"EGY" "USA" 2006  888.4000080750436
"FRA" "EGY" 2006  916.5363648258672
"FRA" "FRA" 2006  685143.9163277873
"FRA" "JOR" 2006  345.7737723813057
"FRA" "USA" 2006 32968.143155763624
"JOR" "EGY" 2006 50.585540661748496
"JOR" "FRA" 2006  8.101419810827256
"JOR" "JOR" 2006 24843.785552740606
"JOR" "USA" 2006 1066.4934238657802
"USA" "EGY" 2006 1738.9365705337525
"USA" "FRA" 2006 25712.636164726257
"USA" "JOR" 2006   449.262461796999
"USA" "USA" 2006  4233436.103399765
end
------------------ copy up to and including the previous line ------------------

Listed 32 out of 32 observations