Sei sulla pagina 1di 4

u07d1 Stacking and Merging Data Files

Discuss both types of file combination procedures and give an example of a situation in educational research where
the procedures might be useful. Be sure to describe the specific variables involved and why either stacking or
merging would give the desired result.

Response Guidelines
Respond to at least two other learners by modifying the situation described in their posts in such a way that one of
the two merging operations would be useful.

Generally speaking, the stacking and merging functions in SPSS are similar as they both involve
operations that combine two data files into one. Both operations are technically merging two
files, but there are some distinct operational differences in the data constituencies and outcomes
of the two data manipulations (Kulas, 2009).
Stacking or concatenating involves combining cases of two different files, which typically
contain the same variables, into one file thus building a larger data set. Variables that do not
exist in both files are usually eliminated by the researcher. Merging or key variable merging is
also basically combining two files into one, but adds new variables to the new file based upon
the sorting and matching of one common variable. Therefore, stacking could be considered an
operation of combining similar variable files with different cases into one file creating a larger
data file, whereas merging is combining two files with similar cases and new variables into one
file, thus creating a more diversified data file.
For example, if multiple researchers are involved in collecting survey data from university
students, the stacking function would be particularly useful. Both dependent and independent
variables would remain consistent but the cases would need to be combined into one file for
further statistical analysis. The following illustrates concatenating by combining cases from two
files named research1 and research2 into one file called survey3 using the ADD FILES
function. Note, if you are listing only one string variable, an asterisk is needed before the name
of the string variable to tell SPSS that the variables listed before the asterisk are numeric not
string variables (SPSS Incorporated, 2009):
DATA LIST LIST /studentname (A8) age wt * sex (A8).
BEGIN DATA
Jane 19 116 "f"
Jim 20 160 "m"
Sharon 21 120 "f"
Tim 21 180 "m"

END DATA.

SAVE OUTFILE = "research1.sav".


LIST.

DATA LIST LIST /studentname (A8) age wt * sex (A8).


BEGIN DATA
Fred 20 150 "m"
Ann 19 112 "f"
George 20 160 "m"
Nicole 22 114 "f"
END DATA.

SAVE OUTFILE = "research2.sav".


LIST.

ADD FILES FILE="research1.sav"


/FILE="research2.sav".
LIST CASES.

SAVE OUTFILE = "survey3.sav".


LIST.

NAME AGE

WT SEX

Jane

19

116

Jim

20

160

Sharon 21

120

Tim

21

180

Fred

20

150

Ann

19

112

George 20

160

Nicole

114

22

If we add another variable called year indicating the number of years in college to one of the
above files we must first sort the cases by the common variable and then merge the two files
using the MATCH FILES command to create a single final version of the file called final1.

DATA LIST LIST /studentname (A8) age wt * sex (A8) year.


BEGIN DATA
Jane 19 116 "f"
Jim 20 160 "m"
Sharon 21 120 "f"
Tim 21 180 "m"
END DATA.

GET FILE = research1.sav.


SORT CASE BY studentname.

SAVE OUTFILE = merge1.sav.

GET FILE = research2.sav.


SORT CASE BY studentname.
SAVE OUTFILE = merge2.sav.

MATCH FILES
/FILE=merge1.sav
/FILE=merge2.sav
/BY studentname.

SAVE OUTFILE = final1.sav.


Anthony Rhodes
General Psychology Ph.D

References

Kulas, J. T. (2009). SPSS essentials: Managing and analyzing social sciences data. San
Francisco, CA: Jossey-Bass. ISBN: 9780470226179.
SPSS Incorporated. (2009). PASW Statistics Graduate Pack (Version 18.0 for Win or MacOS,
formerly SPSS) [Computer software]. Chicago, IL: Author

Potrebbero piacerti anche