1

I am merging two different SPSS data files. Datafile A has variables Var1, Var2, Var3, Var4 Datafile B has variables Var1, Var2, Var3

Var1 in data-file A is numeric and coded (1 = "A", 2 = "B") Var1 in data-file B is numeric and coded (1 = "C", 2 = "D")

How can I merge this two data-files for two conditions:

  1. The merged data-file C has variables with the same name merged: For example Var2 in C contains Var2 in A and Var2 in B
  2. The merged data-file C has variable Var4 same as data-file A and empty cells for B
  3. The merged data-file C has variable Var1 with values and labels unchanged from Var1 in A and Var2 in B:

For Example Var1 in C will have values : 1 with label A, 2 with label D etc

I have tried to merge with method provided in this link: https://www.spss-tutorials.com/merging-data-files/

SPSS data files with similar variables but different cases

but I lose labels in Var1.

Please help appreciated

eli-k
  • 10,898
  • 11
  • 40
  • 44
user1997567
  • 439
  • 4
  • 19

1 Answers1

1

You need to use the add files command, but there is no way to have different labels for the same values in one variable (after adding both files). What I suggest is to change the values so the reflect the source file, and label them accordingly. For exampe:

dataset activate fileA.
recode var1 (1=11)(2=12).
exe.
dataset activate fileB.
recode var1 (1=21)(2=22).
exe.
add files /file=fileA /file=fileB.
exe.
dataset name fileC.
value labels var1 11 'A' 12 'B' 21 'C' 22 'D'.
eli-k
  • 10,898
  • 11
  • 40
  • 44