Thara,
I don’t believe Jim’s suggestion does what you have requested, but it may be doing something you want.
Switching from TABLE to FILE will match only one instance of infringementno in each file.
Using TABLE matches every instance in the FILE file to the data in the TABLE file.
i.e. it assume that there are multiple rows for (each/several) infringementno in DataSet6 (the 667 “FILE’ file) and one row per infringementno in DataSet1
(the 312 “TABLE” file).
Data from Dataset1 are added to each record of Dataset 6 if you use the Table file.
If both files have only one record, or if you only want the first matching record in Dataset6 to be matched with Dataset1 data, then Jim’s recommendation is
better.
However, to identify those that did not match (using either FILE=*/FILE or FILE=*/TABLE), I do believe you are looking for the /IN= subcommand.
The /IN= subcommand creates a dichotomy of whether the file in question has contributed to the matched dataset. In the syntax below ‘in667’ will be 1 if the
record from the first dataset (Dataset6) matched and 0 if it did not.
If you run a 2x2 crosstab you will get information about whether files are in both, DataSet1 only or Dataset6 only (obviously there will never be records that
are not in either file.)
DATASET ACTIVATE DataSet6.
MATCH FILES /FILE=* /IN=in667
/TABLE='DataSet1'
/IN=in312
/BY InfringementNo.
Dataset name matchf.
Cro tab in667 by in312.
Melissa
From: SPSSX(r) Discussion [mailto:[hidden email]]
On Behalf Of Jim Marks
Sent: Thursday, July 19, 2012 8:57 AM
To: [hidden email]
Subject: Re: [SPSSX-L] How do I include a of list of unmatched values within a variable (in tghe result file) while using a match file function
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.
|