How do I include a of list of unmatched values within a variable (in tghe result file) while using a match file function

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

How do I include a of list of unmatched values within a variable (in tghe result file) while using a match file function

thara vardhan-2
Dear list members

I have two data sets with a variable by name infringementno. Dataset 6 – 667 records and Dataset1 – 312 records

I am able to successfully match the 2 file using the following syntax:


DATASET ACTIVATE DataSet6.
MATCH FILES /FILE=*
  /TABLE='DataSet1'
  /BY InfringementNo.
EXECUTE.

The results of match show that 224 records have a matching infringement number in dataset 1.

88 records do not have matching infringement number.

My problem is how do I get the list of infringement numbers for the 88 records that do not match from dataset1?

Is there any way I could add a syntax command to the match file syntax above that would get me the unmatched infringement numbers as a variable in the matched file?

I am able to do it quite quickly in Excel but would like a solution in SPSS because I have to do this for a number of categories each month.

I would be thankful if anybody could help me with this.

Many thanks
Regards
Thara Vardhan


_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

The information contained in this email is intended for the named recipient(s)
only. It may contain private, confidential, copyright or legally privileged
information. If you are not the intended recipient or you have received this
email by mistake, please reply to the author and delete this email immediately.
You must not copy, print, forward or distribute this email, nor place reliance
on its contents. This email and any attachment have been virus scanned. However,
you are requested to conduct a virus scan as well. No liability is accepted
for any loss or damage resulting from a computer virus, or resulting from a delay
or defect in transmission of this email or any attached file. This email does not
constitute a representation by the NSW Police Force unless the author is legally
entitled to do so.


Reply | Threaded
Open this post in threaded view
|

Re: How do I include a of list of unmatched values within a variable (in tghe result file) while using a match file function

Jim Marks

Thada:

Switch dataset1 to the subcommand "FILE" instead of "TABLE" :

DATASET ACTIVATE DataSet6.
MATCH FILES /FILE=*

  /FILE='DataSet1'

  /BY InfringementNo.

EXECUTE.


Note that this will bring all the variables in dataset1 into dataset6. If the other variable names are duplicated in the two files, the values in dataset 6 will be retained. See the results of this sample data:

new file.
data list free /infringementno (f8.0) var1 (f8.0)  var3 (f8.0).
begin data
1 10 11 2 10 22  3 10 33  4 10 44  6 20 66  7 20 77
end data.
dataset name dataset1j window = front.

new file.
data list free /infringementno (f8.0) var1 var2 (2f8.0) .
begin data
1 15 20
2 15 10  
3 15 25
4 30 21
8 15 90  
9 33 11
10 34 89
end data.
dataset name dataset6j window = front.

DATASET ACTIVATE DataSet6j.
MATCH FILES /FILE=*
  /file='DataSet1j'
  /BY InfringementNo.
EXECUTE.

Jim Marks
Sr Market Research Manager
National Market Research
Kaiser Foundation Health Plan of the Mid-Atlantic States, Inc.
2101 E. Jefferson St.
Rockville, MD 20852
Phone: (301) 816-6822
Cell Phone: (301) 456-6164

NOTICE TO RECIPIENT:  If you are not the intended recipient of this e-mail, you are prohibited from sharing, copying, or otherwise using or disclosing its contents.  If you have received this e-mail in error, please notify the sender immediately by reply e-mail and permanently delete this e-mail and any attachments without reading, forwarding or saving them.  Thank you.




From:        Thara Vardhan <[hidden email]>
To:        [hidden email]
Date:        07/18/2012 09:21 PM
Subject:        How do I include a of list of unmatched values within a variable              (in tghe result file) while using a match file function
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Dear list members

I have two data sets with a variable by name infringementno. Dataset 6 – 667 records and Dataset1 – 312 records


I am able to successfully match the 2 file using the following syntax:



DATASET ACTIVATE DataSet6.

MATCH FILES /FILE=*

 /TABLE='DataSet1'

 /BY InfringementNo.

EXECUTE.


The results of match show that 224 records have a matching infringement number in dataset 1.


88 records do not have matching infringement number.


My problem is how do I get the list of infringement numbers for the 88 records that do not match from dataset1?


Is there any way I could add a syntax command to the match file syntax above that would get me the unmatched infringement numbers as a variable in the matched file?


I am able to do it quite quickly in Excel but would like a solution in SPSS because I have to do this for a number of categories each month.


I would be thankful if anybody could help me with this.


Many thanks

Regards

Thara Vardhan


_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

The information contained in this email is intended for the named recipient(s)
only. It may contain private, confidential, copyright or legally privileged
information. If you are not the intended recipient or you have received this
email by mistake, please reply to the author and delete this email immediately.
You must not copy, print, forward or distribute this email, nor place reliance
on its contents. This email and any attachment have been virus scanned. However,
you are requested to conduct a virus scan as well. No liability is accepted
for any loss or damage resulting from a computer virus, or resulting from a delay
or defect in transmission of this email or any attached file. This email does not
constitute a representation by the NSW Police Force unless the author is legally
entitled to do so.



Reply | Threaded
Open this post in threaded view
|

Re: How do I include a list of unmatched values

Richard Ristow
In reply to this post by thara vardhan-2
Since I don't see that this has been answered --
At 09:17 PM 7/18/2012, Thara Vardhan wrote:

>I have two data sets with a variable by name
>infringementno. Dataset 6 – 667 records and Dataset1 – 312 records
>
>I am able to successfully match the 2 file using the following syntax:
>
>
>DATASET ACTIVATE DataSet6.
>MATCH FILES /FILE=*
>   /TABLE='DataSet1'
>   /BY InfringementNo.
>
>The results of match show that 224 records have
>a matching infringement number in dataset 1. 88
>records do not have matching infringement number.
>
>My problem is how do I get the list of
>infringement numbers for the 88 records that do not match from dataset1?

This should work easily with an "IN=" clause:

DATASET ACTIVATE DataSet6.
MATCH FILES /FILE=*
   /TABLE='DataSet1' /IN=Matched
   /BY InfringementNo.

Then variable "Matched" should be 0 or 1,
depending on whether there's a matching record in DataSet1.

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