SPSS Syntax to Merge Multiple Years of NSSE Data

advertisement
*********************Using SPSS to Merge Multiple Years of Data*********************
Step 1 - Create a temporary sub-directory for all your NSSE data: (c:\temp\).
Step 2 - Put all NSSE data files (.SAV files) into the above temporary folder.
Step 3 – Use the “NSSE Year-to-Year Variable Tracking File (2000 to 2010).xls” file to identify variables that can
be used in a multi-year analysis.
After completing the first three steps, choose option A or B. Option A edits Allison’s Merging Syntax Example
to merge files, and option B merges file using the pull-down menus in SPSS.
Option A: Editing Pre-existing example syntax
Step 4 (option A) – Open SPSS. Create a new SPSS syntax file (|File > New > Syntax|). Copy and paste the
syntax from the box below into the new syntax file in order to edit Allison’s Merging Syntax Example
(see the back of this handout for help dissecting this syntax).
Step 5 (option A) – Customize this syntax to match your needs (see the back of this handout for help dissecting
this syntax).
Step 6 (option A) – Run this syntax (|Run > All|)
GET FILE='C:\temp\NSSEville 2006.sav' /KEEP classran inelig smpl05 weight1 gender RESRCH04.
COMPUTE Year = 0 .
VARIABLE LABELS Year 'The year the data was collected' .
VALUE LABELS Year
0 '2006' .
EXECUTE .
SAVE OUTFILE='C:\temp\2006.sav'.
GET FILE='C:\temp\NSSEville 2008.sav' /KEEP classran inelig smpl05 weight1 gender RESRCH04.
COMPUTE Year = 1 .
VARIABLE LABELS Year 'The year the data was collected' .
VALUE LABELS Year
1 '2008' .
EXECUTE .
SAVE OUTFILE='C:\temp\2008.sav'.
GET FILE='C:\temp\2006.sav'.
ADD FILES /FILE=*
/FILE='C:\temp\2008.sav'.
EXECUTE.
SAVE OUTFILE='C:\temp\NSSEville 2006 2008.sav'.
Option B Using SPSS pull-down menus
Step 4 (option B) – Create copies of your .SAV data files. In each of these data files, manually delete any
variables that you are not going to use in your multi-year analyses.
Step 5 (option B) – Compute a new variable (|Transform > Compute Variable…|) called “Year” in each of your
data files (with Year equaling a different number each year: Year=0 in 2006, Year=1 in 2007, Year=2 in
2008, etc.)
Step 6 (option B) – Open your newly created earliest year of data. Merge the remaining years of data one year
at a time (|Data > Merge Files > Add Cases|).
Step 7 (option B) – Save this new file.
********************* Using SPSS to Merge Multiple Years of Data *********************
Dissecting Allison’s Merging Syntax Example:
These commands open my “NSSEville 2006” file
but only keep the variables I want to use.
GET FILE='C:\temp\NSSEville 2006.sav' /KEEP classran inelig smpl05 weight1 gender RESRCH04.
This command creates a new variable “Year” and sets all values of “Year” to zero.
COMPUTE Year = 0 .
VARIABLE LABELS Year 'The year the data was collected' .
VALUE LABELS Year
0 '2006' .
EXECUTE .
These commands gives the variable “Year” an appropriate
variable label and indicates that values of zero mean the data
is from the year 2006.
This command tells SPSS to run the previous commands.
SAVE OUTFILE='C:\temp\2006.sav'.
This command saves your edited file with a new name: 2006.SAV
This first, earliest file is considered your base year file.
GET FILE='C:\temp\NSSEville 2008.sav' /KEEP classran inelig smpl05 weight1 gender RESRCH04.
COMPUTE Year = 1 .
VARIABLE LABELS Year 'The year the data was collected' . This set of commands does the same thing for my 2008 data as I
already did for my 2006 data. The only things I changed were my
VALUE LABELS Year
file names, the number I use for the value of “Year,” and the label
1 '2008' .
EXECUTE .
for the year. I have marked the syntax changes in bold.
SAVE OUTFILE='C:\temp\2008.sav'.
If you have additional years of data to merge, you would repeat this process here for each year of data.
This command opens my newly created base year file.
GET FILE='C:\temp\2006.sav'.
ADD FILES /FILE=*
/FILE='C:\temp\2008.sav'.
EXECUTE.
This command merges the newly created 2008.SAV file with my base-year file 2006.SAV
If you have additional years of data to merge, you would repeat the previous command here. For
example, if I wanted to merge in a 2009.SAV file as well, I would add the following syntax here:
ADD FILES /FILE=*
/FILE=’C:\temp\2009.sav’.
EXECUTE.
SAVE OUTFILE='C:\temp\NSSEville 2006 2008.sav'.
This command saves the new file of merged data as “NSSEville 2006
2008.SAV”
All of the variables that you chose to KEEP for all of the years are
included.
The variable year helps to keep track of which year the data came from—
Year=0 in 2006 and Year=1 in 2008.
Download