Dear All,

I would like to generate a spatial matrix defined by myself. I have the following data:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input byte _ID str52 regionname float control
60 "ABRUZZI - MOLISE - BASILICATA"                         50.2924
46 "ALENTEJO"                                             61.23738
44 "ALGARVE"                                              63.16425
15 "ANDALUCIA"                                            66.64336
12 "ARAGON"                                               60.03899
62 "ASTURIAS-CANTABRIA"                                   61.26402
48 "AZORE ISLANDS"                                        58.78553
 4 "BADEN-WUERTTEMBERG"                                   67.37697
17 "BALEARES"                                               53.125
 9 "BAYERN"                                               67.61789
64 "BREMEN HAMBURG"                                       70.76023
42 "CALABRIA"                                             54.33604
33 "CAMPANIA"                                             62.90082
18 "CANARIAS"                                               67.212
21 "CASTILLA-LA MANCHA"                                   63.17967
19 "CASTILLA-LEON"                                        60.98516
22 "CATALUNA"                                             60.86318
47 "CENTRO (P)"                                           63.31699
14 "COMUNIDAD VALENCIANA"                                 64.48045
68 "EAST ANGLIA"                                          69.62963
27 "EAST FR"                                              59.93266
54 "EAST MIDLANDS"                                        70.89948
41 "EMILIA-ROMAGNA"                                       62.22223
13 "EXTREMADURA"                                          65.83125
10 "GALICIA"                                              62.91752
 7 "HESSEN"                                               65.68987
30 "ILE DE FRANCE"                                        58.97898
38 "LAZIO"                                                64.07407
32 "LIGURIA"                                              64.34853
45 "LISBOA E VALE DO TEJO"                                63.20115
31 "LOMBARDIA"                                            63.11858
49 "MADEIRA"                                              60.85627
20 "MADRID"                                                64.7702
23 "MEDITERREAN FR"                                       59.91285
16 "MURCIA"                                               61.51111
63 "NAVARRA - RIOJA"                                      68.47912
 8 "NIEDERSACHSEN"                                        67.83459
36 "NOORD NEDERLAND - GRONINGEN"                                60
 5 "NORDRHEIN-WESTFALEN"                                  67.86022
43 "NORTE"                                                59.54501
26 "NORTH FR"                                             58.55181
66 "NORTH UK"                                             63.74269
67 "NORTH WEST UK"                                        65.56403
51 "NORTHERN IRELAND"                                     71.61314
34 "OOST NEDERLAND"                                       53.69176
11 "PAIS VASCO"                                           63.40095
29 "PARIS BASIN EAST/WEST"                                57.61317
57 "PIEMONTE - VALLLE D'AOSTA"                            60.84291
39 "PUGLIA"                                               65.39683
 2 "REG.BRUXELLES-CAP./BR"                                64.07563
 3 "REGION WALLONNE"                                      63.26399
65 "RHEINLAND-PFALZ SAARL"                                65.95441
 6 "SCHLESWIG-HOLSTEIN"                                    66.2458
50 "SCOTLAND"                                             67.74318
61 "SICILIA - SARDEGNA"                                   59.67658
25 "SOUTH EAST FR"                                        56.64845
69 "SOUTH EAST UK"                                         67.5137
24 "SOUTH WEST FR"                                        56.08466
53 "SOUTH WEST UK"                                        65.85366
40 "TOSCANA"                                              49.69136
58 "TRENTINO ALTO ADIGE - VENETO - FRIULI VENEZIA GIULIA"   65.722
59 "UMBRIA - MARCHE"                                      55.99647
 1 "VLAAMS GEWEST"                                        60.17209
52 "WALES"                                                66.30566
28 "WEST FR"                                              58.45411
56 "WEST MIDLANDS"                                        60.98766
35 "WEST NEDERLAND"                                       58.64074
55 "YORKSHIRE AND HUMBERS"                                68.10857
37 "ZUID NEDERLAND"                                       57.18254
end
The weights should be based on the difference between the value of control for each European region. I would like to use the spmatrix userdefined routine. My doubt is about the way in which I should organize my data. Specifically, should I add a new column, say control2, identical to control to define the two vectors of data necessary to generate a spatial matrix based on distance, i.e. the difference between the values of control in each region?

I hope to have explained my point clearly.

Thanks in advance.