Creating a Matrix

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Creating a Matrix

Chao Yawo
Hi,

I have a dataset with the following structure.


VarA                  VarB             VarC              VarD
 ClassA            OtherStud        WorkWith        PlayWith

AA                     DD                1                      0
AA                     EE                0                      1
AA                     BB                1                      1
BB                     FF                1                       0
BB                     GG               1                       1
BB                     KK                0                      1
CC                     AA                1                      1
CC                     BB                1                      1


VarA refers to students in ClassroomA, and VarB refers to "Other Students" in the school who could act as work and/or playmates.  Note, VarB could also include some of the same students in ClassroomA who work or play 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

If a student in Classroom A plays with a student in ClassroomB, ColumnD 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 <DD, EE, BB> but only works with DD and BB.  Similarly, Student_CC interacts with two students <AA, and BB> and works and plays with each of them.

Now, I am interested in constructing 2 separate matrices indicating which students in ClassroomA (1) Work and (2) Play 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 and plays with 2 other members of his/her own class<ie, AA and BB>.  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. I would need to produce this matrix for the relation specified in columnC (VarC) and ColumnD (VarD).

I would certainly appreciate some ideas to help me produce this.


Thanks in advance for your assistance.

Sincerely, YY



---------------------------------
Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
Reply | Threaded
Open this post in threaded view
|

Re: Creating a Matrix

Richard Ristow
At 04:07 PM 2/19/2007, Chao Yawo wrote:

>If a Student in Classroom A works with a student in ClassroomB,
>ColumnC takes the value of 1, and 0(zero) if otherwise
>
>I am interested in constructing 2 separate matrices indicating which
>students in ClassroomA (1) Work and (2) Play with each other. 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

See how you like this. It's SPSS 15 draft output.

*  ............................................... .
DATASET ACTIVATE Input.
LIST.

List
|-----------------------------|---------------------------|
|Output Created               |20-FEB-2007 19:23:32       |
|-----------------------------|---------------------------|
[Input]

VarA VarB VarC VarD

AA   DD     1    0
AA   EE     0    1
AA   BB     1    1
BB   FF     1    0
BB   GG     1    1
BB   KK     0    1
CC   AA     1    1
CC   BB     1    1

Number of cases read:  8    Number of cases listed:  8


*  ... Who works with whom ... .
DATASET COPY     WorkWith.

DATASET ACTIVATE WorkWith.
SORT CASES BY VarA VarB .
DELETE VARIABLES VarD.
LIST.

List
|-----------------------------|---------------------------|
|Output Created               |20-FEB-2007 19:23:33       |
|-----------------------------|---------------------------|
[WorkWith]

VarA VarB VarC

AA   BB     1
AA   DD     1
AA   EE     0
BB   FF     1
BB   GG     1
BB   KK     0
CC   AA     1
CC   BB     1

Number of cases read:  8    Number of cases listed:  8


CASESTOVARS
  /ID = VarA
  /INDEX = VarB
  /GROUPBY = VARIABLE .

Cases to Variables
|----------------------------|---------------------------|
|Output Created              |20-FEB-2007 19:23:33       |
|----------------------------|---------------------------|
[WorkWith]

Generated Variables
|--------|----|------|
|Original|VarB|Result|
|Variable|    |------|
|        |    |Name  |
|--------|----|------|
|VarC    |AA  |AA    |
|        |BB  |BB    |
|        |DD  |DD    |
|        |EE  |EE    |
|        |FF  |FF    |
|        |GG  |GG    |
|        |KK  |KK    |
|--------|----|------|

Processing Statistics
|---------------|---|
|Cases In       |8  |
|Cases Out      |3  |
|Cases In/Cases |2.7|
|Out            |   |
|---------------|---|
|Variables In   |3  |
|Variables Out  |8  |
|---------------|---|
|Index Values   |7  |
|---------------|---|


RECODE AA TO KK (SYSMIS = 0).
LIST.

List
|-----------------------------|---------------------------|
|Output Created               |20-FEB-2007 19:23:33       |
|-----------------------------|---------------------------|
[WorkWith]

VarA AA BB DD EE FF GG KK

AA    0  1  1  0  0  0  0
BB    0  0  0  0  1  1  0
CC    1  1  0  0  0  0  0

Number of cases read:  3    Number of cases listed:  3


*  ... Who plays with whom ... .
DATASET ACTIVATE Input.
DATASET COPY     PlayWith.

DATASET ACTIVATE PlayWith.
SORT CASES BY VarA VarB .
DELETE VARIABLES VarC.
LIST.

List
|-----------------------------|---------------------------|
|Output Created               |20-FEB-2007 19:23:34       |
|-----------------------------|---------------------------|
[PlayWith]

VarA VarB VarD

AA   BB     1
AA   DD     0
AA   EE     1
BB   FF     0
BB   GG     1
BB   KK     1
CC   AA     1
CC   BB     1

Number of cases read:  8    Number of cases listed:  8


CASESTOVARS
  /ID = VarA
  /INDEX = VarB
  /GROUPBY = VARIABLE .


Cases to Variables
|----------------------------|---------------------------|
|Output Created              |20-FEB-2007 19:23:34       |
|----------------------------|---------------------------|
[PlayWith]

Generated Variables
|--------|----|------|
|Original|VarB|Result|
|Variable|    |------|
|        |    |Name  |
|--------|----|------|
|VarD    |AA  |AA    |
|        |BB  |BB    |
|        |DD  |DD    |
|        |EE  |EE    |
|        |FF  |FF    |
|        |GG  |GG    |
|        |KK  |KK    |
|--------|----|------|

Processing Statistics
|---------------|---|
|Cases In       |8  |
|Cases Out      |3  |
|Cases In/Cases |2.7|
|Out            |   |
|---------------|---|
|Variables In   |3  |
|Variables Out  |8  |
|Index Values   |7  |
|---------------|---|


RECODE AA TO KK (SYSMIS = 0).
LIST.

List
|-----------------------------|---------------------------|
|Output Created               |20-FEB-2007 19:23:35       |
|-----------------------------|---------------------------|
[PlayWith]

VarA AA BB DD EE FF GG KK

AA    0  1  0  1  0  0  0
BB    0  0  0  0  0  1  1
CC    1  1  0  0  0  0  0

Number of cases read:  3    Number of cases listed:  3

===================
APPENDIX: Test data
===================
DATA LIST LIST SKIP=2
   / VarA VarB VarC VarD (2A2,2F2).
BEGIN DATA
VarA       VarB        VarC       VarD
  ClassA     OtherStud   WorkWith   PlayWith
  AA         DD          1          0
  AA         EE          0          1
  AA         BB          1          1
  BB         FF          1          0
  BB         GG          1          1
  BB         KK          0          1
  CC         AA          1          1
  CC         BB          1          1
END DATA.
DATASET NAME     Input.
Reply | Threaded
Open this post in threaded view
|

Re: Creating a Matrix

Chao Yawo
Richard,

Thanks very much for the quick reply.

I ran the program and got a rectangular matrix.  What I am actually interested is in having the column elements the same as the row.

For example, your recode command (RECODE AA TO KK (SYSMIS = 0). LIST.]] produced this matrix.  Would it be possible to make the column elements AA, BB CC.


[WorkWith]

VarA AA BB DD EE FF GG KK

AA    0  1  1  0  0  0  0
BB    0  0  0  0  1  1  0
CC    1  1  0  0  0  0  0

Thanks very much

regards, YC



Richard Ristow <[hidden email]> wrote: At 04:07 PM 2/19/2007, Chao Yawo wrote:

>If a Student in Classroom A works with a student in ClassroomB,
>ColumnC takes the value of 1, and 0(zero) if otherwise
>
>I am interested in constructing 2 separate matrices indicating which
>students in ClassroomA (1) Work and (2) Play with each other. 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

See how you like this. It's SPSS 15 draft output.

*  ............................................... .
DATASET ACTIVATE Input.
LIST.

List
|-----------------------------|---------------------------|
|Output Created               |20-FEB-2007 19:23:32       |
|-----------------------------|---------------------------|
[Input]

VarA VarB VarC VarD

AA   DD     1    0
AA   EE     0    1
AA   BB     1    1
BB   FF     1    0
BB   GG     1    1
BB   KK     0    1
CC   AA     1    1
CC   BB     1    1

Number of cases read:  8    Number of cases listed:  8


*  ... Who works with whom ... .
DATASET COPY     WorkWith.

DATASET ACTIVATE WorkWith.
SORT CASES BY VarA VarB .
DELETE VARIABLES VarD.
LIST.

List
|-----------------------------|---------------------------|
|Output Created               |20-FEB-2007 19:23:33       |
|-----------------------------|---------------------------|
[WorkWith]

VarA VarB VarC

AA   BB     1
AA   DD     1
AA   EE     0
BB   FF     1
BB   GG     1
BB   KK     0
CC   AA     1
CC   BB     1

Number of cases read:  8    Number of cases listed:  8


CASESTOVARS
  /ID = VarA
  /INDEX = VarB
  /GROUPBY = VARIABLE .

Cases to Variables
|----------------------------|---------------------------|
|Output Created              |20-FEB-2007 19:23:33       |
|----------------------------|---------------------------|
[WorkWith]

Generated Variables
|--------|----|------|
|Original|VarB|Result|
|Variable|    |------|
|        |    |Name  |
|--------|----|------|
|VarC    |AA  |AA    |
|        |BB  |BB    |
|        |DD  |DD    |
|        |EE  |EE    |
|        |FF  |FF    |
|        |GG  |GG    |
|        |KK  |KK    |
|--------|----|------|

Processing Statistics
|---------------|---|
|Cases In       |8  |
|Cases Out      |3  |
|Cases In/Cases |2.7|
|Out            |   |
|---------------|---|
|Variables In   |3  |
|Variables Out  |8  |
|---------------|---|
|Index Values   |7  |
|---------------|---|


RECODE AA TO KK (SYSMIS = 0).
LIST.

List
|-----------------------------|---------------------------|
|Output Created               |20-FEB-2007 19:23:33       |
|-----------------------------|---------------------------|
[WorkWith]

VarA AA BB DD EE FF GG KK

AA    0  1  1  0  0  0  0
BB    0  0  0  0  1  1  0
CC    1  1  0  0  0  0  0

Number of cases read:  3    Number of cases listed:  3


*  ... Who plays with whom ... .
DATASET ACTIVATE Input.
DATASET COPY     PlayWith.

DATASET ACTIVATE PlayWith.
SORT CASES BY VarA VarB .
DELETE VARIABLES VarC.
LIST.

List
|-----------------------------|---------------------------|
|Output Created               |20-FEB-2007 19:23:34       |
|-----------------------------|---------------------------|
[PlayWith]

VarA VarB VarD

AA   BB     1
AA   DD     0
AA   EE     1
BB   FF     0
BB   GG     1
BB   KK     1
CC   AA     1
CC   BB     1

Number of cases read:  8    Number of cases listed:  8


CASESTOVARS
  /ID = VarA
  /INDEX = VarB
  /GROUPBY = VARIABLE .


Cases to Variables
|----------------------------|---------------------------|
|Output Created              |20-FEB-2007 19:23:34       |
|----------------------------|---------------------------|
[PlayWith]

Generated Variables
|--------|----|------|
|Original|VarB|Result|
|Variable|    |------|
|        |    |Name  |
|--------|----|------|
|VarD    |AA  |AA    |
|        |BB  |BB    |
|        |DD  |DD    |
|        |EE  |EE    |
|        |FF  |FF    |
|        |GG  |GG    |
|        |KK  |KK    |
|--------|----|------|

Processing Statistics
|---------------|---|
|Cases In       |8  |
|Cases Out      |3  |
|Cases In/Cases |2.7|
|Out            |   |
|---------------|---|
|Variables In   |3  |
|Variables Out  |8  |
|Index Values   |7  |
|---------------|---|


RECODE AA TO KK (SYSMIS = 0).
LIST.

List
|-----------------------------|---------------------------|
|Output Created               |20-FEB-2007 19:23:35       |
|-----------------------------|---------------------------|
[PlayWith]

VarA AA BB DD EE FF GG KK

AA    0  1  0  1  0  0  0
BB    0  0  0  0  0  1  1
CC    1  1  0  0  0  0  0

Number of cases read:  3    Number of cases listed:  3

===================
APPENDIX: Test data
===================
DATA LIST LIST SKIP=2
   / VarA VarB VarC VarD (2A2,2F2).
BEGIN DATA
VarA       VarB        VarC       VarD
  ClassA     OtherStud   WorkWith   PlayWith
  AA         DD          1          0
  AA         EE          0          1
  AA         BB          1          1
  BB         FF          1          0
  BB         GG          1          1
  BB         KK          0          1
  CC         AA          1          1
  CC         BB          1          1
END DATA.
DATASET NAME     Input.




---------------------------------
Never Miss an Email
Stay connected with Yahoo! Mail on your mobile. Get started!
Reply | Threaded
Open this post in threaded view
|

Re: Creating a Matrix

Richard Ristow
At 06:08 AM 2/21/2007, Chao Yawo wrote:

>What I am actually interested is in having the column elements the
>same as the row. For example, your recode command (RECODE AA TO KK
>(SYSMIS = 0). LIST.]] produced this matrix.  Would it be possible to
>make the column elements AA, BB CC.
>
>VarA AA BB DD EE FF GG KK
>
>AA    0  1  1  0  0  0  0
>BB    0  0  0  0  1  1  0
>CC    1  1  0  0  0  0  0

The RECODE has nothing to do with it, of course; it's the CASESTOVARS.
You want, for rows, all the students there are, not just all the ones
who occur as "plays with" or "works with" for some other student. I
suppose you want rows for every student, as well.

The following works by creating an empty 'square' dataset, with a row
and a variable for every student mentioned in the file; creating the
rectangular matrix, as above; and combining them. I haven't explored
how programmability could simplify this, but it probably could.

This does the matrix for who works with whom, only. Who plays with
whom, would be identical logic.

*  ......................................................... .
*  This code uses 'datasets' (SPSS 14 and 15) where possible .
*  (you can't XSAVE to a dataset). The code could be re-cast .
*  to use .SAV files instead, to run in earlier releases.    .

*  ++++  The test data +++++++ .
DATASET ACTIVATE TestData.
LIST.

List
|-----------------------------|---------------------------|
|Output Created               |04-MAR-2007 00:41:29       |
|-----------------------------|---------------------------|
[TestData]

VarA VarB VarC VarD

AA   DD     1    0
AA   EE     0    1
AA   BB     1    1
BB   FF     1    0
BB   GG     1    1
BB   KK     0    1
CC   AA     1    1
CC   BB     1    1

Number of cases read:  8    Number of cases listed:  8


*  "I am interested in having the column elements the same   .
*  as the row."                                              .
*  I.     Create a dataset with records and variables for    .
*         every student in the files, but no data            .
*  I.A.   File with all students, at least one record, for   .
*         each, with the student 'name' twice in the record. .

DATASET ACTIVATE TestData.
DATASET COPY     To_XSave.
DATASET ACTIVATE To_Xsave WINDOW=FRONT.
STRING  #StdtA #StdtB (A2).
COMPUTE #StdtA = VarA.
COMPUTE #StdtB = VarB.

VECTOR STUDS=#StdtA TO #StdtB.
LOOP #Stud# = 1 TO 2.
.  COMPUTE VarA = STUDS(#Stud#).
.  COMPUTE VarB = STUDS(#Stud#).
.  XSAVE OUTFILE= AllStdts

 >Warning # 142.  Command name: XSAVE
 >LOOP has no effect on this command.

    /KEEP=VarA VarB.
END LOOP.
EXECUTE.

GET     FILE=AllStdts.
DATASET NAME AllStdts WINDOW=FRONT.
.  /**/  LIST  /*-*/.

List
|-----------------------------|---------------------------|
|Output Created               |04-MAR-2007 00:41:32       |
|-----------------------------|---------------------------|
[AllStdts] C:\Documents and Settings\Richard\My Documents
              \Temporary\SPSS
              \2007-02-19 Yawo - Creating a Matrix - ALLSTDTS.SAV

VarA VarB

AA   AA
DD   DD
AA   AA
EE   EE
AA   AA
BB   BB
BB   BB
FF   FF
BB   BB
GG   GG
BB   BB
KK   KK
CC   CC
AA   AA
CC   CC
BB   BB

Number of cases read:  16    Number of cases listed:  16


*  I.B.   Down to a single record per student. This also     .
*         alphabetizes them.                                 .

AGGREGATE OUTFILE=*
    /BREAK=VarA VarB
    /POPULAR 'No. of times student is mentioned' = NU.
.  /**/  LIST  /*-*/.

List [suppressed]


*  I.C.   Then, CASESTOVARS to get the file with one record  .
*         and one variable per student, and no data          .

COMPUTE    POPULAR = $SYSMIS.
FORMATS    POPULAR  (F3).
VAR LABELS POPULAR ''.
.  /**/  LIST  /*-*/.

List [suppressed]


CASESTOVARS
  /ID = VarA
  /INDEX = VarB
  /RENAME POPULAR=V
  /GROUPBY = VARIABLE
  /AUTOFIX = NO.

Cases to Variables
|----------------------------|---------------------------|
|Output Created              |04-MAR-2007 00:41:33       |
|----------------------------|---------------------------|
Warnings
|---------------|
|Variable       |
|POPULAR is     |
|constant in    |
|every case     |
|group, but was |
|not specified  |
|in the FIXED   |
|subcommand.    |
|---------------|

Generated Variables
|--------|----|------|
|Original|VarB|Result|
|Variable|    |------|
|        |    |Name  |
|--------|----|------|
|POPULAR |AA  |AA    |
|        |BB  |BB    |
|        |CC  |CC    |
|        |DD  |DD    |
|        |EE  |EE    |
|        |FF  |FF    |
|        |GG  |GG    |
|        |KK  |KK    |
|--------|----|------|

Processing Statistics
|---------------|---|
|Cases In       |8  |
|Cases Out      |8  |
|---------------|---|
|Cases In/Cases |1.0|
|Out            |   |
|---------------|---|
|Variables In   |3  |
|Variables Out  |9  |
|---------------|---|
|Index Values   |8  |
|---------------|---|


DATASET NAME Square WINDOW=FRONT.
LIST.

List
|-----------------------------|---------------------------|
|Output Created               |04-MAR-2007 00:41:33       |
|-----------------------------|---------------------------|
[Square]

VarA  AA  BB  CC  DD  EE  FF  GG  KK

AA     .   .   .   .   .   .   .   .
BB     .   .   .   .   .   .   .   .
CC     .   .   .   .   .   .   .   .
DD     .   .   .   .   .   .   .   .
EE     .   .   .   .   .   .   .   .
FF     .   .   .   .   .   .   .   .
GG     .   .   .   .   .   .   .   .
KK     .   .   .   .   .   .   .   .

Number of cases read:  8    Number of cases listed:  8


*  II.    Create the matrix of who works with whom           .

*  II.A.  New dataset, for that matrix, with a copy of the   .
*         original data                                      .
*         (In releases before 14, replace this with GET FILE).

DATASET ACTIVATE TestData.
.  /**/  LIST  /*-*/.

List [suppressed]

DATASET COPY     WorkWith.
DATASET ACTIVATE WorkWith WINDOW=FRONT.
*  II.B.  Prepare for CASESTOVARS, by sorting, and dropping  .
*         variable not going into the transposed data.       .

SORT CASES BY VarA VarB .
DELETE VARIABLES VarD.
.  /**/  LIST  /*-*/.

List [suppressed]


*  II.C.  CASESTOVARS: the matrix, in rectangular form       .

CASESTOVARS
  /ID      = VarA
  /INDEX   = VarB
  /GROUPBY = VARIABLE
  /AUTOFIX = NO.


Cases to Variables
|----------------------------|---------------------------|
|Output Created              |04-MAR-2007 00:41:34       |
|----------------------------|---------------------------|
[WorkWith]

Generated Variables
|--------|----|------|
|Original|VarB|Result|
|Variable|    |------|
|        |    |Name  |
|--------|----|------|
|VarC    |AA  |AA    |
|        |BB  |BB    |
|        |DD  |DD    |
|        |EE  |EE    |
|        |FF  |FF    |
|        |GG  |GG    |
|        |KK  |KK    |
|--------|----|------|

Processing Statistics
|---------------|---|
|Cases In       |8  |
|Cases Out      |3  |
|---------------|---|
|Cases In/Cases |2.7|
|Out            |   |
|---------------|---|
|Variables In   |3  |
|Variables Out  |8  |
|---------------|---|
|Index Values   |7  |
|---------------|---|


.  /**/  LIST  /*-*/.

List
|-----------------------------|---------------------------|
|Output Created               |04-MAR-2007 00:41:35       |
|-----------------------------|---------------------------|
[WorkWith]

VarA AA BB DD EE FF GG KK

AA    .  1  1  0  .  .  .
BB    .  .  .  .  1  1  0
CC    1  1  .  .  .  .  .

Number of cases read:  3    Number of cases listed:  3


*  II.D.  "Square it off" by combining with the empty        .
*         square matrix                                      .

ADD FILES
   /FILE =Square
   /FILE =*
   /BY    VarA
   /LAST =ThisOne.

*  II.E.  Replace missing by 0. This requires a knowledge of .
*         what variables were created, or programmibility to .
*         build the list from the active dictionary.         .

RECODE AA TO KK (SYSMIS = 0).

*  II.F.  Drop null rows where there are corresponding real  .
*         rows, and list                                     .

SELECT IF ThisOne.
LIST.

List
|-----------------------------|---------------------------|
|Output Created               |04-MAR-2007 00:41:36       |
|-----------------------------|---------------------------|
[WorkWith]

VarA  AA  BB  CC  DD  EE  FF  GG  KK ThisOne

AA     0   1   0   1   0   0   0   0    1
BB     0   0   0   0   0   1   1   0    1
CC     1   1   0   0   0   0   0   0    1
DD     0   0   0   0   0   0   0   0    1
EE     0   0   0   0   0   0   0   0    1
FF     0   0   0   0   0   0   0   0    1
GG     0   0   0   0   0   0   0   0    1
KK     0   0   0   0   0   0   0   0    1

Number of cases read:  8    Number of cases listed:  8

===================
APPENDIX: Test data
===================
*  ..........   File handle, and test data   ............... .

FILE HANDLE AllStdts
    /NAME='C:\Documents and Settings\Richard\My
Documents\Temporary\SPSS\' +
          '2007-02-19 Yawo - Creating a Matrix'         +
          ' -
'                                                            +
          'ALLSTDTS.SAV'.

DATA LIST LIST SKIP=2
   / VarA VarB VarC VarD (2A2,2F2).
BEGIN DATA
VarA       VarB        VarC       VarD
  ClassA     OtherStud   WorkWith   PlayWith
  AA         DD          1          0
  AA         EE          0          1
  AA         BB          1          1
  BB         FF          1          0
  BB         GG          1          1
  BB         KK          0          1
  CC         AA          1          1
  CC         BB          1          1
END DATA.
DATASET NAME     TestData.
Reply | Threaded
Open this post in threaded view
|

Deleting Cases from Data (Matrix)

Chao Yawo
Hi Happy New Year !!

Thanks to you all, especially to Richard Ristow for helping me create my data matrix.

I now have the data (in a matrix format). It is 990 x 990 (cases x variable) data.

Now, I need to create a subset of this matrix -- of about 300 cases (by a criteria that I have in another file) and export the reduced matrix to Excel.

So, I now have two datasets.  (1) the big matrix with all the cases which looks like a regular matrix with 990 cases by cases elements, which looks like this:

    AA   BB  CC  DD
AA
BB
CC
DD

and (2) the smaller dataset with a subset of the cases, but with a variable that I can use as a criteria to select cases from the bigger matrix.. this smaller file looks like this:

Cases:    Variable:

AA            1
BB            1
CC               1
DD                1

That is all cases from this smaller dataset (those with a value of 1 for the criterion variable)  need to be extracted from the bigger matrix above, and exported as a sub-matrix into Excel.

I have tried using merge and match files, but was not successful....I am still pounding at it, but thought I could post here for any possible assistance.

thanks - Chow

---------------------------------
Never miss a thing.   Make Yahoo your homepage.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD