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
Related Posts with Creating a square matrix using two relational variables
Marginsplot axis value labelsI'm using marginsplot to graph a repeated measures anova, with the timepoints labeled t0-t9. This me…
Drop panel if condition of at least one observation of panel is trueHi together, i use stata 16.0 and have a panel data set including banks (unique identifier is the v…
Convergence error in calculating of productivity by SFA - "Kumbhakar, S.C, 2015"Dear everyone, I am calculating total factor productivity by SFA model in using STATA. When I run …
How to construct the distribution of propensity scores calculated from the pre-match conditional logistic regression?Dear Statalists, Hope my message finds you well. I am trying to construct an estimated propensity …
Binning times in hours, rounding error?Hello, I am trying to truncate times to only the hour using floor so that I can merge all data for …
Subscribe to:
Post Comments (Atom)
0 Response to Creating a square matrix using two relational variables
Post a Comment