SPSS merge

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

SPSS merge

Lacay, Phebe
Hi All,

In SPSS does anyone know a way to merge 2 files that have duplicate
records.  For example:  if I'm merging on CRN's  and there are 5
students who have the same CRN in the first file, when I merge the
second file the data only appears for the first record containing the
joined CRN.  Something like this:

 

ID         CRN                 Term                 Title
EFFdate

1          16773               200710              Microsoft Excel
Intermediate       200520  

2          16773


3          16773


4          16773


5          16773


 

So the question is how to make all CRN's match including the Term,
Title, and EFFdate, so it looks like this:

 

ID         CRN                 Term                 Title
EFFdate

1          16773               200710              Microsoft Excel
Intermediate       200520  

2          16773               200710              Microsoft Excel
Intermediate       200520  

3          16773               200710              Microsoft Excel
Intermediate       200520  

4          16773               200710              Microsoft Excel
Intermediate       200520  

5          16773               200710              Microsoft Excel
Intermediate       200520  

 

 

Any Suggestions??

 

 

 

                   
Reply | Threaded
Open this post in threaded view
|

Re: SPSS merge

Maguin, Eugene
Lacay,

Look at the table subcommand on the match files command. If file1 has
multiple records with the same id and you want to add variables to file1
from file2 so that all records with the same id get the new values from
file2 for that id, then table is the subcommand.

Gene Maguin
Reply | Threaded
Open this post in threaded view
|

Re: SPSS merge

Mark A Davenport MADAVENP
In reply to this post by Lacay, Phebe
Lacey,

An elaboration on what Gene correctly told you.  SPSS calls the unique
file a 'Keyed-Table".

Example:

File 1 has dups.  File 2...don't.

MATCH FILES /FILE=C:\File1.sav
 /TABLE= C:\File2 .sav'
 /BY custnumber
EXECUTE.

What Gene was referring to is the /TABLE subcommand.  The file referenced
here is the keyed table and must NOT have dups.   Remember that both must
be sorted by the variable you are matching on (in this case, custnumber,
your case, CRN).

In the menu system, this is set up by going through the merge process,
adding variables, merging the dups TO the unique, keyed-table file,
matching on the match variable (custnumber or CRN) and clicking on the
"Non-active file is keyed-table".

REMEMBER sort both files by CRN first.

***************************************************************************************************************************************************************
Mark A. Davenport Ph.D.
Senior Research Analyst
Office of Institutional Research
The University of North Carolina at Greensboro
336.256.0395
[hidden email]

'An approximate answer to the right question is worth a good deal more
than an exact answer to an approximate question.' --a paraphrase of J. W.
Tukey (1962)






"Lacay, Phebe" <[hidden email]>
Sent by: "SPSSX(r) Discussion" <[hidden email]>
10/10/2007 09:48 AM
Please respond to
"Lacay, Phebe" <[hidden email]>


To
[hidden email]
cc

Subject
SPSS merge






Hi All,

In SPSS does anyone know a way to merge 2 files that have duplicate
records.  For example:  if I'm merging on CRN's  and there are 5
students who have the same CRN in the first file, when I merge the
second file the data only appears for the first record containing the
joined CRN.  Something like this:



ID         CRN                 Term                 Title
EFFdate

1          16773               200710              Microsoft Excel
Intermediate       200520

2          16773


3          16773


4          16773


5          16773




So the question is how to make all CRN's match including the Term,
Title, and EFFdate, so it looks like this:



ID         CRN                 Term                 Title
EFFdate

1          16773               200710              Microsoft Excel
Intermediate       200520

2          16773               200710              Microsoft Excel
Intermediate       200520

3          16773               200710              Microsoft Excel
Intermediate       200520

4          16773               200710              Microsoft Excel
Intermediate       200520

5          16773               200710              Microsoft Excel
Intermediate       200520





Any Suggestions??