```Date: Sat, 23 Oct 2010 12:12:15 +0200 Reply-To: John F Hall Sender: "SPSSX(r) Discussion" From: John F Hall Subject: Re: Help with Square Matrix Comments: To: Chao Yawo Content-Type: multipart/alternative; I used Art's syntax and tried this to see what the result looked like: does it help as an intermediate step? data list list/rowkid (a2) colkid(a2) link(f1). begin data AA DD 1 AA EE 0 AA BB 1 BB FF 1 BB GG 1 BB KK 0 CC AA 1 CC BB 1 end data. cros rowkid by colkid by link. rowkid * colkid * link Crosstabulation Count link colkid Total AA BB DD EE FF GG KK 0 rowkid AA ? ? ? 1 ? ? 0 1 BB ? ? ? 0 ? ? 1 1 Total ? ? ? 1 ? ? 1 2 1 rowkid AA 0 1 1 ? 0 0 ? 2 BB 0 0 0 ? 1 1 ? 2 CC 1 1 0 ? 0 0 ? 2 Total 1 2 1 ? 1 1 ? 6 ----- Original Message ----- From: Chao Yawo To: SPSSX-L@LISTSERV.UGA.EDU Sent: Friday, October 22, 2010 7:29 AM Subject: Help with Square Matrix Hi, I have a dataset with the following structure. ColumnA ColumnB ColumnC ClassA OtherStud WorkWith AA DD 1 AA EE 0 AA BB 1 BB FF 1 BB GG 1 BB KK 0 CC AA 1 CC BB 1 ColumnA refers to students in ClassroomA, and Column B refers to "Other Students" in the school who could act as work and/or playmates. Note, ColumnB could also include some of the same students in ColumnA(ClassA) who work with each other (For example, Students: AA and BB). If a Student in Classroom A works with a student in ClassroomB, ColumnC takes the value of 1, and 0(zero) if otherwise So, looking at ColumnA, we find that there are three students: AA, BB and CC. Student_AA for instance interacts with three students but only works with DD and BB. Similarly, Student_CC interacts with two students and works and plays with each of them. Now, I am interested in constructing a matrix indicating which students in ClassroomA work with each other. This means that student_AA for instance works with student_BB, who is in his/her classroom, hence the cell in their matrix will have a "1". Again, Student_CC in ClassroomA works with 2 other members of his/her own class. So CC would have two "1s" in the matrix. The resulting matrix for the "Works With" relation (ColumnC) among the 3 students in ClassroomA would look like this. AA BB CC AA 0 1 0 BB 0 0 0 CC 1 1 0 This matrix is the output I am interested in, and need to produce for the relationship specified in Column C.I would certainly appreciate some ideas to help me produce this. Thanks in advance for your assistance. Sincerely, Cy [text/html] ```

Back to: Top of message | Previous page | Main SPSSX-L page