Hi,
I've spent 5-6 hours browsing the help files and past posts, but could not find the answer to what seems to be a very simple procedure. I used UCINet and Pajek before and want to switch to STATA working with matrices.
I have two relational variables: students and classes that they are enrolled in. I want to create a square class-by-class matrix that would show the number of students in common in each class pair. This is very similar to the classic Southern Women study, albeit with a much larger data set. The initial two-variable dataset looks like this:
class student
1 1
1 2
1 3
1 4
1 5
2 2
2 3
2 5
3 1
3 5
4 2
4 4
4 5
I want to end up with (in the above example) 4x4 class matrix (with zeros in the diagonal). I appreciate any suggestion for Stata, Mata, or nwcommands.
Cheers,
Mikhail
I've spent 5-6 hours browsing the help files and past posts, but could not find the answer to what seems to be a very simple procedure. I used UCINet and Pajek before and want to switch to STATA working with matrices.
I have two relational variables: students and classes that they are enrolled in. I want to create a square class-by-class matrix that would show the number of students in common in each class pair. This is very similar to the classic Southern Women study, albeit with a much larger data set. The initial two-variable dataset looks like this:
class student
1 1
1 2
1 3
1 4
1 5
2 2
2 3
2 5
3 1
3 5
4 2
4 4
4 5
I want to end up with (in the above example) 4x4 class matrix (with zeros in the diagonal). I appreciate any suggestion for Stata, Mata, or nwcommands.
Cheers,
Mikhail
Comment