Dear Statalists,
I have 2 columns (popid and forumid)
I would like to create one type of adjacency matrix to look like this:
1) Both column headings and row headings for the ids, the values inside the matrix equals the number of forums co-attended, zero otherwise. The diagonal equals zero (do not take into account the id itself).
Can anyone help me with this, please?
I really appreciate your help.
Kind regards,
Aria
------------------ copy up to and including the previous line ------------------
Listed 50 out of 1350 observations
I have 2 columns (popid and forumid)
I would like to create one type of adjacency matrix to look like this:
1) Both column headings and row headings for the ids, the values inside the matrix equals the number of forums co-attended, zero otherwise. The diagonal equals zero (do not take into account the id itself).
1 | 3 | 8 | 18 | ........ | |
1 | 0 | 2 | 0 | 3 | ........ |
3 | 2 | 0 | 6 | 1 | ........ |
8 | 0 | 6 | 0 | 0 | ......... |
18 | 3 | 1 | 0 | 0 | ....... |
I really appreciate your help.
Kind regards,
Aria
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input double popid float forumid 1 452 1 455 1 431 1 33 3 85 8 455 8 247 8 36 18 452 23 443 23 4 23 35 23 455 23 312 26 53 29 39 29 489 36 460 38 232 38 63 42 452 42 357 42 271 46 206 46 310 46 198 60 85 60 9 65 218 65 139 65 468 65 455 65 391 71 4 71 455 71 447 71 437 79 443 79 442 85 394 85 447 86 340 86 327 86 151 86 272 86 259 88 353 90 244 90 503 92 361 end
Listed 50 out of 1350 observations
Comment