Comparing two data files in SPSS

Suppose you want to compare two files to see if they are identical or not.

In SPSS, COMPARE DATASETS compares the active dataset to another dataset to check identical or mismatching values in variables.

Data File 1

Name Score1 Score2 Score3
Sam 77 68 66
Deepanshu 50 71 89
Sandy 71 91 50
Shane 55 78 89
Roger 50 97 86
Iqbal 56 63 56
Priya 88 68 93

Data File 2
Name Score1 Score2 Score3
Sam 77 68 66
Deepanshu 50 94 89
Sandy 71 91 50
Shane 55 78 89
Roger 50 74 81
Iqbal 56 63 56
Priya 81 68 92

Step 1 : Set up the above data sets in SPSS

Data File 1
Note : Edit the file path in the above syntax- "C:\Desktop\datafile1.sav".

Data File 2
Note : Edit the file path in the above syntax- "C:\Desktop\datafile2.sav".

Step 2 : Open *Data File 1* SPSS File

Step 3 : Run the following syntax

Points to note : 
1. The COMPDATASET subcommand specifies the dataset that will be compared to the active dataset.
2. Change the file path with the path where datafile2 is saved.
3. The VARIABLES subcommand specifies the variables to be compared.

Examples : 

1. If you want to compare files on the basis of Score1 variable
The VARIABLES subcommand will be : /VARIABLES Score1 .

2. If you want to compare files on the basis of two variables - Score1 and Score2
The VARIABLES subcommand will be : /VARIABLES  Score1 Score2 .

3. If you want to compare files on the basis of all the variables
The VARIABLES subcommand will be : /VARIABLES  ALL .

Output :


About Author:

Deepanshu founded ListenData with a simple objective - Make analytics easy to understand and follow. He has close to 7 years of experience in data science and predictive modeling. During his tenure, he has worked with global clients in various domains like retail and commercial banking, Telecom, HR and Automotive.


While I love having friends who agree, I only learn from those who don't.

Let's Get Connected: Email | LinkedIn

Get Free Email Updates :
*Please confirm your email address by clicking on the link sent to your Email*

Related Posts:

0 Response to "Comparing two data files in SPSS"

Post a Comment

Next → ← Prev