Hi all,

I have the following database

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str3 exporter_iso_3digit int exporter_code str6 prod6_code float tradevalue
"AFG" 4 "090930"     7.073
"AFG" 4 "121110"     1.094
"AFG" 4 "121190"     1.216
"AFG" 4 "340520"  2.287137
"AFG" 4 "570210"     1.748
"AFG" 4 "081350"    41.452
"AFG" 4 "200559" 1.1830153
"AFG" 4 "490110"     1.486
"AFG" 4 "570110"    57.794
"AFG" 4 "570210"     1.602
"AFG" 4 "732399" 2.4719744
"AFG" 4 "847149"     4.003
"AFG" 4 "848310"     1.963
"AFG" 4 "850434"    38.097
"AFG" 4 "020890"     3.345
"AFG" 4 "440110" 4.3026867
"AFG" 4 "570110"    30.253
"AFG" 4 "840734"   164.238
"AFG" 4 "847160"     3.978
"AFG" 4 "847180"     5.999
"AFG" 4 "847330"     1.268
"AFG" 4 "090411"     1.197
"AFG" 4 "090930"     7.117
"AFG" 4 "252020"  2.847957
"AFG" 4 "520812"    43.556
"AFG" 4 "550820"     4.168
"AFG" 4 "842123"     2.229
"AFG" 4 "847149"    82.835
"AFG" 4 "950390"     3.564
"AFG" 4 "071390"  40.48638
"AFG" 4 "080250"    37.661
"AFG" 4 "081320" 228.67145
"AFG" 4 "090700"    72.677
"AFG" 4 "090930"  8280.039
"AFG" 4 "121190"      12.6
"AFG" 4 "121190"     9.608
"AFG" 4 "420212"    11.293
"AFG" 4 "510211"  7150.839
"AFG" 4 "610130"     1.862
"AFG" 4 "620192"     1.364
"AFG" 4 "620349"     7.792
"AFG" 4 "620520"     1.077
"AFG" 4 "620630"     1.549
"AFG" 4 "621430"      8.15
"AFG" 4 "841869"     117.7
"AFG" 4 "843149"     1.607
"AFG" 4 "847130"     3.084
"AFG" 4 "847180"     1.234
"AFG" 4 "853690"     6.164
"AFG" 4 "880330"     3.872
"AFG" 4 "950699"     6.751
"AFG" 4 "630900"  1.350208
"AFG" 4 "570500"     3.207
"AFG" 4 "321519" 1.5357955
"AFG" 4 "382490"  13.41808
"AFG" 4 "390422"  24.23597
"AFG" 4 "391710"     2.266
"AFG" 4 "490290"  8.850664
"AFG" 4 "570210"     1.077
"AFG" 4 "570241"     1.022
"AFG" 4 "721932"  32.84437
"AFG" 4 "731824" 1.0275272
"AFG" 4 "820719"     5.387
"AFG" 4 "830120"     4.971
"AFG" 4 "844240"     3.074
"AFG" 4 "848049"     1.646
"AFG" 4 "848240"     7.144
"AFG" 4 "848340"     3.685
"AFG" 4 "852910"       3.5
"AFG" 4 "853690"     6.051
"AFG" 4 "870829" 2.4361446
"AFG" 4 "870839"  4.862935
"AFG" 4 "901380"     150.8
"AFG" 4 "920510"    18.576
"AFG" 4 "940510" 18.030067
"AFG" 4 "040390"  3.316522
"AFG" 4 "841480"     6.799
"AFG" 4 "901890"     1.526
"AFG" 4 "940350"     3.652
"AFG" 4 "940540"     2.962
"AFG" 4 "121190"    10.747
"AFG" 4 "520100" 23.540577
"AFG" 4 "853669"    11.088
"AFG" 4 "080620"  436.9971
"AFG" 4 "300432" 22.201687
"AFG" 4 "842481"      2.91
"AFG" 4 "080620"  12.16069
"AFG" 4 "081340" 10.403205
"AFG" 4 "220421"    15.252
"AFG" 4 "292700" 1.2319666
"AFG" 4 "420100" 1.2461592
"AFG" 4 "481730"  2.418623
"AFG" 4 "490199" 15.580884
"AFG" 4 "570110"    73.187
"AFG" 4 "570210"     8.741
"AFG" 4 "570310"     5.884
"AFG" 4 "611710"     1.385
"AFG" 4 "620342"      1.94
"AFG" 4 "640411"     6.353
"AFG" 4 "710310"     1.517
end
which represents trade flows of a country (200 countries in total) for specific products (5000 products in total). My aim is to construct a country x product matrix and export it to Matlab.
The desired form is the following, calling products p_i and country c_i:

c_1 c_2 c_3 ... c_200
p_1
p_2
p_3
p_4
...
p_5000


Is there a way to do that?

Thank you very much,

Federico