how to match two different files

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

how to match two different files

jimjohn
hi guys can somenoe plz help with this:
i have two different spss files (files A and B), there is one common variable in both these files: poolno.
there is a column in file B called nummtgs but no such column exists in file A. each poolno will have many different cases associated with it. what i want to do is match the two files and wherever the poolno#'s are the same, i want to add in a new column in file A that has the maximum nummtgs for that pool. so my new column in file A, different cases with the same poolno will have the same maximum nummtgs.

does anyone know if thsi is possible in spss, and if so, how i can go about it? or plz let me know if im not explaining the problem well enough. thanks!
Reply | Threaded
Open this post in threaded view
|

Re: how to match two different files

Melissa Ives
Jimjohn,

Sure--aggregate file B keeping a separate output file with poolno and
max(nummtgs), then match to file A.

Something like (untested):
Get file='B.sav'.
Sort cases by poolno.
Aggregate
outfile='<path>\maxtgs.sav'/break=poolid/mxnummtgs=max(nummtgs).

** assumes that file A is sorted by poolno already.
Match files file='A.sav'/file='<path>\maxtgs.sav'/by poolno.

Melissa

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
jimjohn
Sent: Friday, February 08, 2008 1:32 PM
To: [hidden email]
Subject: [SPSSX-L] how to match two different files

hi guys can somenoe plz help with this:
i have two different spss files (files A and B), there is one common
variable in both these files: poolno.
there is a column in file B called nummtgs but no such column exists in
file A. each poolno will have many different cases associated with it.
what i want to do is match the two files and wherever the poolno#'s are
the same, i want to add in a new column in file A that has the maximum
nummtgs for that pool. so my new column in file A, different cases with
the same poolno will have the same maximum nummtgs.

does anyone know if thsi is possible in spss, and if so, how i can go
about it? or plz let me know if im not explaining the problem well
enough. thanks!

--
View this message in context:
http://www.nabble.com/how-to-match-two-different-files-tp15362377p153623
77.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
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


PRIVILEGED AND CONFIDENTIAL INFORMATION
This transmittal and any attachments may contain PRIVILEGED AND
CONFIDENTIAL information and is intended only for the use of the
addressee. If you are not the designated recipient, or an employee
or agent authorized to deliver such transmittals to the designated
recipient, you are hereby notified that any dissemination,
copying or publication of this transmittal is strictly prohibited. If
you have received this transmittal in error, please notify us
immediately by replying to the sender and delete this copy from your
system. You may also call us at (309) 827-6026 for assistance.

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: how to match two different files

jimjohn
thanks melissa! i tried this but i think poolno has to be unique for it to work. in file A, one poolno can have many different records associated with it. can i just say /by poolno /by variable /by variable 3, and then as long as the combination of these variables is unique, it should work fine? also, once i run this match files will it create a new data file or will it just use one of the two existing files and add to it? thanks so much.



Melissa Ives wrote
Jimjohn,

Sure--aggregate file B keeping a separate output file with poolno and
max(nummtgs), then match to file A.

Something like (untested):
Get file='B.sav'.
Sort cases by poolno.
Aggregate
outfile='<path>\maxtgs.sav'/break=poolid/mxnummtgs=max(nummtgs).

** assumes that file A is sorted by poolno already.
Match files file='A.sav'/file='<path>\maxtgs.sav'/by poolno.

Melissa

-----Original Message-----
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of
jimjohn
Sent: Friday, February 08, 2008 1:32 PM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: [SPSSX-L] how to match two different files

hi guys can somenoe plz help with this:
i have two different spss files (files A and B), there is one common
variable in both these files: poolno.
there is a column in file B called nummtgs but no such column exists in
file A. each poolno will have many different cases associated with it.
what i want to do is match the two files and wherever the poolno#'s are
the same, i want to add in a new column in file A that has the maximum
nummtgs for that pool. so my new column in file A, different cases with
the same poolno will have the same maximum nummtgs.

does anyone know if thsi is possible in spss, and if so, how i can go
about it? or plz let me know if im not explaining the problem well
enough. thanks!

--
View this message in context:
http://www.nabble.com/how-to-match-two-different-files-tp15362377p153623
77.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (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


PRIVILEGED AND CONFIDENTIAL INFORMATION
This transmittal and any attachments may contain PRIVILEGED AND
CONFIDENTIAL information and is intended only for the use of the
addressee. If you are not the designated recipient, or an employee
or agent authorized to deliver such transmittals to the designated
recipient, you are hereby notified that any dissemination,
copying or publication of this transmittal is strictly prohibited. If
you have received this transmittal in error, please notify us
immediately by replying to the sender and delete this copy from your
system. You may also call us at (309) 827-6026 for assistance.

=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (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
Reply | Threaded
Open this post in threaded view
|

Re: how to match two different files

Melissa Ives
In reply to this post by jimjohn
Yes, the match 'by' variable list has to be unique, but you are correct
that it can be a list--just do
        /by poolno variable variable
And be sure BOTH files have and are sorted by all variables listed.

When you match a file, it replaces the working file with the matched
file--then you would need to save that with a new name.  (I believe in
Versions 14+ SPSS opens a new untitled file.)

Melissa

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
jimjohn
Sent: Monday, February 11, 2008 10:25 AM
To: [hidden email]
Subject: Re: [SPSSX-L] how to match two different files

thanks melissa! i tried this but i think poolno has to be unique for it
to work. in file A, one poolno can have many different records
associated with it. can i just say /by poolno /by variable /by variable
3, and then as long as the combination of these variables is unique, it
should work fine? also, once i run this match files will it create a new
data file or will it just use one of the two existing files and add to
it? thanks so much.




Melissa Ives wrote:

>
> Jimjohn,
>
> Sure--aggregate file B keeping a separate output file with poolno and
> max(nummtgs), then match to file A.
>
> Something like (untested):
> Get file='B.sav'.
> Sort cases by poolno.
> Aggregate
> outfile='<path>\maxtgs.sav'/break=poolid/mxnummtgs=max(nummtgs).
>
> ** assumes that file A is sorted by poolno already.
> Match files file='A.sav'/file='<path>\maxtgs.sav'/by poolno.
>
> Melissa
>
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf
> Of jimjohn
> Sent: Friday, February 08, 2008 1:32 PM
> To: [hidden email]
> Subject: [SPSSX-L] how to match two different files
>
> hi guys can somenoe plz help with this:
> i have two different spss files (files A and B), there is one common
> variable in both these files: poolno.
> there is a column in file B called nummtgs but no such column exists
> in file A. each poolno will have many different cases associated with
it.

> what i want to do is match the two files and wherever the poolno#'s
> are the same, i want to add in a new column in file A that has the
> maximum nummtgs for that pool. so my new column in file A, different
> cases with the same poolno will have the same maximum nummtgs.
>
> does anyone know if thsi is possible in spss, and if so, how i can go
> about it? or plz let me know if im not explaining the problem well
> enough. thanks!
>
> --
> View this message in context:
> http://www.nabble.com/how-to-match-two-different-files-tp15362377p1536
> 23
> 77.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> 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
>
>
> PRIVILEGED AND CONFIDENTIAL INFORMATION This transmittal and any
> attachments may contain PRIVILEGED AND CONFIDENTIAL information and is

> intended only for the use of the addressee. If you are not the
> designated recipient, or an employee or agent authorized to deliver
> such transmittals to the designated recipient, you are hereby notified

> that any dissemination, copying or publication of this transmittal is
> strictly prohibited. If you have received this transmittal in error,
> please notify us immediately by replying to the sender and delete this

> copy from your system. You may also call us at (309) 827-6026 for
> assistance.
>
> =====================
> 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
>
>

--
View this message in context:
http://www.nabble.com/how-to-match-two-different-files-tp15362377p154135
36.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
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

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: how to match two different files

Richard Ristow
Side issue: At 12:44 PM 2/11/2008, Melissa Ives wrote:

>Yes, the match 'by' variable list has to be unique, but you are
>correct that it can be a list--just do
>         /by poolno variable variable
>And be sure BOTH files have and are sorted by all variables listed.

Yes, exactly.

>When you match a file, it replaces the working file with the matched
>file--then you would need to save that with a new name.  (I believe
>in Versions 14+ SPSS opens a new untitled file.)

If you specify FILE=* or TABLE=* on the match, it replaces the
working file with the matched file. Otherwise, it creates a new
unnamed dataset.

(I did a rough tutorial on datasets a while back: "Using datasets in
SPSS 14", Tue, 18 Jul 2006 15:48:58 -0400. It could use a few
revisions, but it's basically sound.)

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: how to match two different files

Bob Schacht-3
At 08:49 AM 2/11/2008, Richard Ristow wrote:
>Side issue: At 12:44 PM 2/11/2008, Melissa Ives wrote:
>
>>Yes, the match 'by' variable list has to be unique, but you are
>>correct that it can be a list--just do
>>         /by poolno variable variable
>>And be sure BOTH files have and are sorted by all variables listed.
>
>Yes, exactly.

Just to add onto this, it may be important that your matching variables be
*exactly* the same type and width, because otherwise SPSS may have
problems. As I have discovered from experience, it is all too easy to
assume that the variables match when in fact various considerations have
lead you to make them different for some forgotten reason.

Bob Schacht


Robert M. Schacht, Ph.D. <[hidden email]>
Pacific Basin Rehabilitation Research & Training Center
1268 Young Street, Suite #204
Research Center, University of Hawaii
Honolulu, HI 96814

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: how to match two different files

jimjohn
In reply to this post by jimjohn
ok thanks guys!


jimjohn wrote
hi guys can somenoe plz help with this:
i have two different spss files (files A and B), there is one common variable in both these files: poolno.
there is a column in file B called nummtgs but no such column exists in file A. each poolno will have many different cases associated with it. what i want to do is match the two files and wherever the poolno#'s are the same, i want to add in a new column in file A that has the maximum nummtgs for that pool. so my new column in file A, different cases with the same poolno will have the same maximum nummtgs.

does anyone know if thsi is possible in spss, and if so, how i can go about it? or plz let me know if im not explaining the problem well enough. thanks!
Reply | Threaded
Open this post in threaded view
|

Re: how to match two different files

jimjohn
In reply to this post by Melissa Ives
but is there a way to do this if my variable list isnt unique. for example, if i have two separate files that i want to match by poolno. although the poolno's will be unique in file B, file A will have different records with the same poolno. so for every record in file A with the same poolno, all the variable values from file B will be the same. any ideas? thanks.


Melissa Ives wrote
Yes, the match 'by' variable list has to be unique, but you are correct
that it can be a list--just do
        /by poolno variable variable
And be sure BOTH files have and are sorted by all variables listed.

When you match a file, it replaces the working file with the matched
file--then you would need to save that with a new name.  (I believe in
Versions 14+ SPSS opens a new untitled file.)

Melissa

-----Original Message-----
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of
jimjohn
Sent: Monday, February 11, 2008 10:25 AM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: Re: [SPSSX-L] how to match two different files

thanks melissa! i tried this but i think poolno has to be unique for it
to work. in file A, one poolno can have many different records
associated with it. can i just say /by poolno /by variable /by variable
3, and then as long as the combination of these variables is unique, it
should work fine? also, once i run this match files will it create a new
data file or will it just use one of the two existing files and add to
it? thanks so much.




Melissa Ives wrote:
>
> Jimjohn,
>
> Sure--aggregate file B keeping a separate output file with poolno and
> max(nummtgs), then match to file A.
>
> Something like (untested):
> Get file='B.sav'.
> Sort cases by poolno.
> Aggregate
> outfile='<path>\maxtgs.sav'/break=poolid/mxnummtgs=max(nummtgs).
>
> ** assumes that file A is sorted by poolno already.
> Match files file='A.sav'/file='<path>\maxtgs.sav'/by poolno.
>
> Melissa
>
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf
> Of jimjohn
> Sent: Friday, February 08, 2008 1:32 PM
> To: SPSSX-L@LISTSERV.UGA.EDU
> Subject: [SPSSX-L] how to match two different files
>
> hi guys can somenoe plz help with this:
> i have two different spss files (files A and B), there is one common
> variable in both these files: poolno.
> there is a column in file B called nummtgs but no such column exists
> in file A. each poolno will have many different cases associated with
it.
> what i want to do is match the two files and wherever the poolno#'s
> are the same, i want to add in a new column in file A that has the
> maximum nummtgs for that pool. so my new column in file A, different
> cases with the same poolno will have the same maximum nummtgs.
>
> does anyone know if thsi is possible in spss, and if so, how i can go
> about it? or plz let me know if im not explaining the problem well
> enough. thanks!
>
> --
> View this message in context:
> http://www.nabble.com/how-to-match-two-different-files-tp15362377p1536
> 23
> 77.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> LISTSERV@LISTSERV.UGA.EDU (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
>
>
> PRIVILEGED AND CONFIDENTIAL INFORMATION This transmittal and any
> attachments may contain PRIVILEGED AND CONFIDENTIAL information and is

> intended only for the use of the addressee. If you are not the
> designated recipient, or an employee or agent authorized to deliver
> such transmittals to the designated recipient, you are hereby notified

> that any dissemination, copying or publication of this transmittal is
> strictly prohibited. If you have received this transmittal in error,
> please notify us immediately by replying to the sender and delete this

> copy from your system. You may also call us at (309) 827-6026 for
> assistance.
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> LISTSERV@LISTSERV.UGA.EDU (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
>
>

--
View this message in context:
http://www.nabble.com/how-to-match-two-different-files-tp15362377p154135
36.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (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

=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (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
Reply | Threaded
Open this post in threaded view
|

Re: how to match two different files

ViAnn Beadle
Look at the TABLE subcommand.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
jimjohn
Sent: Wednesday, February 13, 2008 9:35 AM
To: [hidden email]
Subject: Re: how to match two different files

but is there a way to do this if my variable list isnt unique. for example,
if i have two separate files that i want to match by poolno. although the
poolno's will be unique in file B, file A will have different records with
the same poolno. so for every record in file A with the same poolno, all the
variable values from file B will be the same. any ideas? thanks.



Melissa Ives wrote:

>
> Yes, the match 'by' variable list has to be unique, but you are correct
> that it can be a list--just do
>         /by poolno variable variable
> And be sure BOTH files have and are sorted by all variables listed.
>
> When you match a file, it replaces the working file with the matched
> file--then you would need to save that with a new name.  (I believe in
> Versions 14+ SPSS opens a new untitled file.)
>
> Melissa
>
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
> jimjohn
> Sent: Monday, February 11, 2008 10:25 AM
> To: [hidden email]
> Subject: Re: [SPSSX-L] how to match two different files
>
> thanks melissa! i tried this but i think poolno has to be unique for it
> to work. in file A, one poolno can have many different records
> associated with it. can i just say /by poolno /by variable /by variable
> 3, and then as long as the combination of these variables is unique, it
> should work fine? also, once i run this match files will it create a new
> data file or will it just use one of the two existing files and add to
> it? thanks so much.
>
>
>
>
> Melissa Ives wrote:
>>
>> Jimjohn,
>>
>> Sure--aggregate file B keeping a separate output file with poolno and
>> max(nummtgs), then match to file A.
>>
>> Something like (untested):
>> Get file='B.sav'.
>> Sort cases by poolno.
>> Aggregate
>> outfile='<path>\maxtgs.sav'/break=poolid/mxnummtgs=max(nummtgs).
>>
>> ** assumes that file A is sorted by poolno already.
>> Match files file='A.sav'/file='<path>\maxtgs.sav'/by poolno.
>>
>> Melissa
>>
>> -----Original Message-----
>> From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf
>> Of jimjohn
>> Sent: Friday, February 08, 2008 1:32 PM
>> To: [hidden email]
>> Subject: [SPSSX-L] how to match two different files
>>
>> hi guys can somenoe plz help with this:
>> i have two different spss files (files A and B), there is one common
>> variable in both these files: poolno.
>> there is a column in file B called nummtgs but no such column exists
>> in file A. each poolno will have many different cases associated with
> it.
>> what i want to do is match the two files and wherever the poolno#'s
>> are the same, i want to add in a new column in file A that has the
>> maximum nummtgs for that pool. so my new column in file A, different
>> cases with the same poolno will have the same maximum nummtgs.
>>
>> does anyone know if thsi is possible in spss, and if so, how i can go
>> about it? or plz let me know if im not explaining the problem well
>> enough. thanks!
>>
>> --
>> View this message in context:
>> http://www.nabble.com/how-to-match-two-different-files-tp15362377p1536
>> 23
>> 77.html
>> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>>
>> =====================
>> 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
>>
>>
>> PRIVILEGED AND CONFIDENTIAL INFORMATION This transmittal and any
>> attachments may contain PRIVILEGED AND CONFIDENTIAL information and is
>
>> intended only for the use of the addressee. If you are not the
>> designated recipient, or an employee or agent authorized to deliver
>> such transmittals to the designated recipient, you are hereby notified
>
>> that any dissemination, copying or publication of this transmittal is
>> strictly prohibited. If you have received this transmittal in error,
>> please notify us immediately by replying to the sender and delete this
>
>> copy from your system. You may also call us at (309) 827-6026 for
>> assistance.
>>
>> =====================
>> 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
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/how-to-match-two-different-files-tp15362377p154135
> 36.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> 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
>
> =====================
> 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
>
>

--
View this message in context:
http://www.nabble.com/how-to-match-two-different-files-tp15362377p15459858.h
tml
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
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

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: how to match two different files

Melissa Ives
In reply to this post by jimjohn
If you want to match file B (unique poolno) with EVERY record in file A
(multiple records for poolno), then use

Match files file=file A/table=file B/by poolno.

File A
Pool no vars
   1            1 2 2
   1            2 2 2
   1            2 3 3
   2            3 2 1
   2            1 2 3
   3            2 2 2

File B
   1  x
   2  y
   3  z

Final file
Pool no vars
   1            1 2 2   x
   1            2 2 2 x
   1            2 3 3 x
   2            3 2 1   y
   2            1 2 3 y
   3            2 2 2 z
Melissa

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
jimjohn
Sent: Wednesday, February 13, 2008 10:35 AM
To: [hidden email]
Subject: Re: [SPSSX-L] how to match two different files

but is there a way to do this if my variable list isnt unique. for
example, if i have two separate files that i want to match by poolno.
although the poolno's will be unique in file B, file A will have
different records with the same poolno. so for every record in file A
with the same poolno, all the variable values from file B will be the
same. any ideas? thanks.



Melissa Ives wrote:
>
> Yes, the match 'by' variable list has to be unique, but you are
> correct that it can be a list--just do
>         /by poolno variable variable
> And be sure BOTH files have and are sorted by all variables listed.
>
> When you match a file, it replaces the working file with the matched
> file--then you would need to save that with a new name.  (I believe in

> Versions 14+ SPSS opens a new untitled file.)
>
> Melissa
>
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf
> Of jimjohn
> Sent: Monday, February 11, 2008 10:25 AM
> To: [hidden email]
> Subject: Re: [SPSSX-L] how to match two different files
>
> thanks melissa! i tried this but i think poolno has to be unique for
> it to work. in file A, one poolno can have many different records
> associated with it. can i just say /by poolno /by variable /by
> variable 3, and then as long as the combination of these variables is
> unique, it should work fine? also, once i run this match files will it

> create a new data file or will it just use one of the two existing
> files and add to it? thanks so much.
>
>
>
>
> Melissa Ives wrote:
>>
>> Jimjohn,
>>
>> Sure--aggregate file B keeping a separate output file with poolno and

>> max(nummtgs), then match to file A.
>>
>> Something like (untested):
>> Get file='B.sav'.
>> Sort cases by poolno.
>> Aggregate
>> outfile='<path>\maxtgs.sav'/break=poolid/mxnummtgs=max(nummtgs).
>>
>> ** assumes that file A is sorted by poolno already.
>> Match files file='A.sav'/file='<path>\maxtgs.sav'/by poolno.
>>
>> Melissa
>>
>> -----Original Message-----
>> From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf

>> Of jimjohn
>> Sent: Friday, February 08, 2008 1:32 PM
>> To: [hidden email]
>> Subject: [SPSSX-L] how to match two different files
>>
>> hi guys can somenoe plz help with this:
>> i have two different spss files (files A and B), there is one common
>> variable in both these files: poolno.
>> there is a column in file B called nummtgs but no such column exists
>> in file A. each poolno will have many different cases associated with
> it.
>> what i want to do is match the two files and wherever the poolno#'s
>> are the same, i want to add in a new column in file A that has the
>> maximum nummtgs for that pool. so my new column in file A, different
>> cases with the same poolno will have the same maximum nummtgs.
>>
>> does anyone know if thsi is possible in spss, and if so, how i can go

>> about it? or plz let me know if im not explaining the problem well
>> enough. thanks!
>>
>> --
>> View this message in context:
>> http://www.nabble.com/how-to-match-two-different-files-tp15362377p153
>> 6
>> 23
>> 77.html
>> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>>
>> =====================
>> 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
>>
>>
>> PRIVILEGED AND CONFIDENTIAL INFORMATION This transmittal and any
>> attachments may contain PRIVILEGED AND CONFIDENTIAL information and
>> is
>
>> intended only for the use of the addressee. If you are not the
>> designated recipient, or an employee or agent authorized to deliver
>> such transmittals to the designated recipient, you are hereby
>> notified
>
>> that any dissemination, copying or publication of this transmittal is

>> strictly prohibited. If you have received this transmittal in error,
>> please notify us immediately by replying to the sender and delete
>> this
>
>> copy from your system. You may also call us at (309) 827-6026 for
>> assistance.
>>
>> =====================
>> 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
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/how-to-match-two-different-files-tp15362377p1541
> 35
> 36.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> 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
>
> =====================
> 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
>
>

--
View this message in context:
http://www.nabble.com/how-to-match-two-different-files-tp15362377p154598
58.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
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

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: how to match two different files

Marks, Jim
In reply to this post by jimjohn
DATASET ACTIVATE B.
MATCH FILES /FILE = * /TABLE = A /BY poolno.
EXE.

this should match all the variables from file A to all the cases in file
B (where there is a match on poolno).

requires both files to be sorted on poolno before attempting the match.

will not work if file A has duplicate values of poolno.

will work if file B has duplicate values of poolno

--jim

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
jimjohn
Sent: Wednesday, February 13, 2008 10:35 AM
To: [hidden email]
Subject: Re: how to match two different files

but is there a way to do this if my variable list isnt unique. for
example, if i have two separate files that i want to match by poolno.
although the poolno's will be unique in file B, file A will have
different records with the same poolno. so for every record in file A
with the same poolno, all the variable values from file B will be the
same. any ideas? thanks.



Melissa Ives wrote:
>
> Yes, the match 'by' variable list has to be unique, but you are
> correct that it can be a list--just do
>         /by poolno variable variable
> And be sure BOTH files have and are sorted by all variables listed.
>
> When you match a file, it replaces the working file with the matched
> file--then you would need to save that with a new name.  (I believe in

> Versions 14+ SPSS opens a new untitled file.)
>
> Melissa
>
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf
> Of jimjohn
> Sent: Monday, February 11, 2008 10:25 AM
> To: [hidden email]
> Subject: Re: [SPSSX-L] how to match two different files
>
> thanks melissa! i tried this but i think poolno has to be unique for
> it to work. in file A, one poolno can have many different records
> associated with it. can i just say /by poolno /by variable /by
> variable 3, and then as long as the combination of these variables is
> unique, it should work fine? also, once i run this match files will it

> create a new data file or will it just use one of the two existing
> files and add to it? thanks so much.
>
>
>
>
> Melissa Ives wrote:
>>
>> Jimjohn,
>>
>> Sure--aggregate file B keeping a separate output file with poolno and

>> max(nummtgs), then match to file A.
>>
>> Something like (untested):
>> Get file='B.sav'.
>> Sort cases by poolno.
>> Aggregate
>> outfile='<path>\maxtgs.sav'/break=poolid/mxnummtgs=max(nummtgs).
>>
>> ** assumes that file A is sorted by poolno already.
>> Match files file='A.sav'/file='<path>\maxtgs.sav'/by poolno.
>>
>> Melissa
>>
>> -----Original Message-----
>> From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf

>> Of jimjohn
>> Sent: Friday, February 08, 2008 1:32 PM
>> To: [hidden email]
>> Subject: [SPSSX-L] how to match two different files
>>
>> hi guys can somenoe plz help with this:
>> i have two different spss files (files A and B), there is one common
>> variable in both these files: poolno.
>> there is a column in file B called nummtgs but no such column exists
>> in file A. each poolno will have many different cases associated with
> it.
>> what i want to do is match the two files and wherever the poolno#'s
>> are the same, i want to add in a new column in file A that has the
>> maximum nummtgs for that pool. so my new column in file A, different
>> cases with the same poolno will have the same maximum nummtgs.
>>
>> does anyone know if thsi is possible in spss, and if so, how i can go

>> about it? or plz let me know if im not explaining the problem well
>> enough. thanks!
>>
>> --
>> View this message in context:
>> http://www.nabble.com/how-to-match-two-different-files-tp15362377p153
>> 6
>> 23
>> 77.html
>> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>>
>> =====================
>> 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
>>
>>
>> PRIVILEGED AND CONFIDENTIAL INFORMATION This transmittal and any
>> attachments may contain PRIVILEGED AND CONFIDENTIAL information and
>> is
>
>> intended only for the use of the addressee. If you are not the
>> designated recipient, or an employee or agent authorized to deliver
>> such transmittals to the designated recipient, you are hereby
>> notified
>
>> that any dissemination, copying or publication of this transmittal is

>> strictly prohibited. If you have received this transmittal in error,
>> please notify us immediately by replying to the sender and delete
>> this
>
>> copy from your system. You may also call us at (309) 827-6026 for
>> assistance.
>>
>> =====================
>> 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
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/how-to-match-two-different-files-tp15362377p1541
> 35
> 36.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> 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
>
> =====================
> 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
>
>

--
View this message in context:
http://www.nabble.com/how-to-match-two-different-files-tp15362377p154598
58.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
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

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: how to match two different files

jimjohn
In reply to this post by Melissa Ives
thanks!

Melissa Ives wrote
If you want to match file B (unique poolno) with EVERY record in file A
(multiple records for poolno), then use

Match files file=file A/table=file B/by poolno.

File A
Pool no vars
   1            1 2 2
   1            2 2 2
   1            2 3 3
   2            3 2 1
   2            1 2 3
   3            2 2 2

File B
   1  x
   2  y
   3  z

Final file
Pool no vars
   1            1 2 2   x
   1            2 2 2 x
   1            2 3 3 x
   2            3 2 1   y
   2            1 2 3 y
   3            2 2 2 z
Melissa

-----Original Message-----
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of
jimjohn
Sent: Wednesday, February 13, 2008 10:35 AM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: Re: [SPSSX-L] how to match two different files

but is there a way to do this if my variable list isnt unique. for
example, if i have two separate files that i want to match by poolno.
although the poolno's will be unique in file B, file A will have
different records with the same poolno. so for every record in file A
with the same poolno, all the variable values from file B will be the
same. any ideas? thanks.



Melissa Ives wrote:
>
> Yes, the match 'by' variable list has to be unique, but you are
> correct that it can be a list--just do
>         /by poolno variable variable
> And be sure BOTH files have and are sorted by all variables listed.
>
> When you match a file, it replaces the working file with the matched
> file--then you would need to save that with a new name.  (I believe in

> Versions 14+ SPSS opens a new untitled file.)
>
> Melissa
>
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf
> Of jimjohn
> Sent: Monday, February 11, 2008 10:25 AM
> To: SPSSX-L@LISTSERV.UGA.EDU
> Subject: Re: [SPSSX-L] how to match two different files
>
> thanks melissa! i tried this but i think poolno has to be unique for
> it to work. in file A, one poolno can have many different records
> associated with it. can i just say /by poolno /by variable /by
> variable 3, and then as long as the combination of these variables is
> unique, it should work fine? also, once i run this match files will it

> create a new data file or will it just use one of the two existing
> files and add to it? thanks so much.
>
>
>
>
> Melissa Ives wrote:
>>
>> Jimjohn,
>>
>> Sure--aggregate file B keeping a separate output file with poolno and

>> max(nummtgs), then match to file A.
>>
>> Something like (untested):
>> Get file='B.sav'.
>> Sort cases by poolno.
>> Aggregate
>> outfile='<path>\maxtgs.sav'/break=poolid/mxnummtgs=max(nummtgs).
>>
>> ** assumes that file A is sorted by poolno already.
>> Match files file='A.sav'/file='<path>\maxtgs.sav'/by poolno.
>>
>> Melissa
>>
>> -----Original Message-----
>> From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf

>> Of jimjohn
>> Sent: Friday, February 08, 2008 1:32 PM
>> To: SPSSX-L@LISTSERV.UGA.EDU
>> Subject: [SPSSX-L] how to match two different files
>>
>> hi guys can somenoe plz help with this:
>> i have two different spss files (files A and B), there is one common
>> variable in both these files: poolno.
>> there is a column in file B called nummtgs but no such column exists
>> in file A. each poolno will have many different cases associated with
> it.
>> what i want to do is match the two files and wherever the poolno#'s
>> are the same, i want to add in a new column in file A that has the
>> maximum nummtgs for that pool. so my new column in file A, different
>> cases with the same poolno will have the same maximum nummtgs.
>>
>> does anyone know if thsi is possible in spss, and if so, how i can go

>> about it? or plz let me know if im not explaining the problem well
>> enough. thanks!
>>
>> --
>> View this message in context:
>> http://www.nabble.com/how-to-match-two-different-files-tp15362377p153
>> 6
>> 23
>> 77.html
>> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>> LISTSERV@LISTSERV.UGA.EDU (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
>>
>>
>> PRIVILEGED AND CONFIDENTIAL INFORMATION This transmittal and any
>> attachments may contain PRIVILEGED AND CONFIDENTIAL information and
>> is
>
>> intended only for the use of the addressee. If you are not the
>> designated recipient, or an employee or agent authorized to deliver
>> such transmittals to the designated recipient, you are hereby
>> notified
>
>> that any dissemination, copying or publication of this transmittal is

>> strictly prohibited. If you have received this transmittal in error,
>> please notify us immediately by replying to the sender and delete
>> this
>
>> copy from your system. You may also call us at (309) 827-6026 for
>> assistance.
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>> LISTSERV@LISTSERV.UGA.EDU (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
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/how-to-match-two-different-files-tp15362377p1541
> 35
> 36.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> LISTSERV@LISTSERV.UGA.EDU (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
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> LISTSERV@LISTSERV.UGA.EDU (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
>
>

--
View this message in context:
http://www.nabble.com/how-to-match-two-different-files-tp15362377p154598
58.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (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

=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (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