Download Notes for Intro Guide
Transcript
6 Combining data from separate files 6.1.1 Combining the data in SPSS The matching of the two data files in SPSS is achieved by using the match files command. The necessary syntax and menu-based procedures are set out below. Before proceeding, however, users should note that match files will only work with files saved in *.sav format. The SPSS WERS98 data is generally supplied in *.por format. These files therefore need to be converted to *.sav format before the match files can be used through either the syntax or menu-based route. Users should also note that the match files command requires that both data files are sorted in ascending order of the key variable (SERNO in this case). The Management and Worker Representative data files are sorted in this way when supplied by the Data Archive. However, if users wish to use the command with data files that they have themselves derived from the source files (or if they have re-sorted and saved the original files), they must ensure that the two files are sorted by SERNO before matching. Using syntax: The required syntax is as follows: match files file="d:\wers98\mq98fin.sav" /table="d:\wers98\wrq98.sav" /by serno . If Mq98fin.sav is already open in the SPSS Data Editor, the phrase "d:\wers98\mq98fin.sav" can be replaced with an asterisk, as follows: match files file=* /table="d:\wers98\wrq98.sav" /by serno . In both of these examples, all of the variables in the Worker Representative data file will be matched onto the end of the appropriate record in the Management data file. Users are referred to the on-line SPSS User Manual for details of the additional functionality that is available from the match files command, such as the ability to keep and drop sets of variables during the matching process. Using the menu system: 1. Open the Management data file Mq98fin.sav. 2. From the ‘Data’ menu, select the ‘Merge Files’ option and then the subsequent option to ‘Add Variables…’. 3. Select Wrq98.sav as the read file. 4. In the ‘Add Variables’ window, check the square box labelled ‘Match cases on key variables in sorted files’. Then check the circle underneath it labelled ‘External file is keyed table’. 5. Select SERNO from the list headed ‘Excluded variables’ and use the arrow to the left hand side of the list headed ‘Key variables’ to transfer SERNO into this list. 49