Merging two files with identical variables

Moderators: statman, Analyst Techy, andris, Fierce, GerineL, Smash

OleScheinfrei
Posts: 2
Joined: Thu Jul 17, 2014 3:40 pm

Merging two files with identical variables

Postby OleScheinfrei » Thu Jul 17, 2014 3:53 pm

Hi there,

I want to merge two files with completely identical variable names. In the first file I've got missing data for case 2. But I can find this missing data in my second SPSS File.

SPSS-File 1: Case 2 has missing values

Key---Var1---Var2---Var3
-1-------2------2-------6--
-2------- ----- ------- --
-3-------2------2-------4--


SPSS-File 2: Here are my missing values!

Key---Var1---Var2---Var3
-1------- ------ ------- --
-2-------2------3-------2--
-3------- ------ ------- --

My goal:

Key---Var1---Var2---Var3
-1-------2------2-------6--
-2-------2------3-------2--
-3-------2------2-------4--

Of course I've tried to merge both files with the dropdown menu:
  • Sorting the "Key"-variable in both files in ascending order (and all the variables have got the same properties)
  • Data -> Merge data... -> Add cases... (but this only adds my second SPSS-file under the first one).
  • Data -> Merge data... -> Add variables... (this does nothing at all).
I would be so happy if you could help me out or give me a hint how I can solve my problem.
Thank you
RubenGeert
Posts: 100
Joined: Mon May 19, 2014 6:06 am

Re: Merging two files with identical variables

Postby RubenGeert » Fri Jul 18, 2014 6:47 am

First, your results make perfect sense if you understand how

ADD FILES http://www.spss-tutorials.com/add-files/ and
MATCH FILES http://www.spss-tutorials.com/match-files/

work. What you may be looking for, is UPDATE (didn't write on that one yet).

But what is supposed to happen if both files hold different valid values for a given case/variable? Or doesn't that occur with your data?

P.s. you could resolve this with ADD FILES and then unduplicate cases but at this point UPDATE seems an easier option.

Kind regards,

Ruben Geert van den Berg
www.spss-tutorials.com
OleScheinfrei
Posts: 2
Joined: Thu Jul 17, 2014 3:40 pm

Re: Merging two files with identical variables

Postby OleScheinfrei » Fri Jul 18, 2014 10:00 am

Thank you so much, RubenGeert, I'm so happy that it works :).

UPDATE solved the problem. And for all the other people with a similar problem this is what I've found to be helpful, too: http://www.ats.ucla.edu/stat/spss/faq/update.htm

To answer your question: It's not the case that two of my files hold different valid values for the same case/variable. So every file only contains exclusive data.

Who is online

Users browsing this forum: No registered users and 4 guests

cron