Hi all,
I have a database looking like this (mine is longer):
What I would like to do is to end up with an incidence matrix. Please notice that the countries as variable names are also those in the first row.
So the first step would be to transfer the variable name to the first observation like this:
Then I would like to reshape this db into an incidence matrix. In the example above, the incidence would be an 8x8 matrix looking as follows:
[CODE]
AFG USA FRA ITA ESP ZWE DEU CHN
AFG . . . . . . . 1
USA . . 1 . . . . .
FRA. . . . 1 . . . .
ITA. . 1 . . . . . .
ESP. . . . 1 . . . .
ZWE . . . . 1 . . .
DEU. . . . 1 . . . .
CHN. . . . . . 1 . .
[CODE]
Thank you
I have a database looking like this (mine is longer):
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str3(afg usa fra ita esp zwe deu chn) "CHN" "FRA" "ITA" "USA" "ITA" "ESP" "ITA" "ZWE" end
So the first step would be to transfer the variable name to the first observation like this:
Code:
input str3(v1 v2 v3 v4 v5 v6 v7 v8) "afg" "usa" "fra" "ita" "esp" "zwe" "deu" "chn" "CHN" "FRA" "ITA" "USA" "ITA" "ESP" "ITA" "ZWE" end
[CODE]
AFG USA FRA ITA ESP ZWE DEU CHN
AFG . . . . . . . 1
USA . . 1 . . . . .
FRA. . . . 1 . . . .
ITA. . 1 . . . . . .
ESP. . . . 1 . . . .
ZWE . . . . 1 . . .
DEU. . . . 1 . . . .
CHN. . . . . . 1 . .
[CODE]
Thank you

Comment