SPSS can read data from a variety of existing data sources. In this assignment, you will read data from an ASCII text file, a Microsoft Excel Spreadsheet, and a dBASE IV database.
Resources Needed: To complete this assignment you need to download the required data sets. Click here to go to the list of data sets, or click on "Downloadable Data Sets" on the SOC 3050 index page. Once you see the list of downloadable files, make sure your disk, memory stick, or CD is in place, then right-click on the file named "nhdata.dbf" and select "Save target as...." When the "Save As" window appears, indicate to which device the file should be saved then click "Save." Follow this same procedure for "nhdata.txt," "nhdata.xls," and "nhdata_codebook.xls." You may save all four files to the same device.
Reading Data from an ASCII Text File: After you have downloaded all four files, open "nhdata_codebook.xls" to open the codebook for these data sets using Excel. Print the codebook then close Excel. Next, open "nhdata.txt" to briefly view the data in the text file. Note that the data begin on the first line of the text file, the columns are neatly aligned, and there are no column headings. Close the text editor.
Next, open SPSS. Click on "File" then on "Read Text Data." When the "Open File" window appears, make sure you are looking for files on your storage device, select "nhdata.txt" then click "Open." The SPSS Text Import Wizard will open. We are not using a pre-defined format, so select "No" in answer to the first question then click "Next." The codebook and our glance at the data set indicates the text file is fixed-width (exact column locations are specified), so select "Fixed width" in response to the first question on the second screen. Further, since there are no column headings in the file, select "No" to second question then click "Next." Our brief look at the data set indicates that data for the first case begins on line 1, so leave this set to 1. Also, the codebook indicates that all the data for a case falls on one line, so leave this set to 1 as well. Finally, we want to read data from all the cases, so leave this item selected and click "Next." Look carefully at the suggested column breaks. If they are incorrect, adjust them by clicking on a break and dragging to the appropriate position. You may add new breaks by double-clicking where they should be located. Once all the breaks are in place, click "Next." On the next screen, use the codebook to name each variable in the data set and indicate data format (numerical, string, date, etc.). Click on the "V2," "V3," etc. column headings to select each variable. After you have named and indicated the data format for all the variables, click "Next." On the final screen, select "No" to both questions then click "Finish." The data should then appear in the SPSS Data View. Save the data you have read into SPSS as an SPSS data file named "txt.sav."
Reading Data from an Excel Spreadsheet: Next, find and open "nhdata.xls" in Microsoft Excel and look at the data in the spreadsheet. Note that the spreadsheet does contain headings for each column of data. When finished, close Excel. Open SPSS, click on "File" then "Open" then "Data," or click on the open envelope on the toolbar. Make sure you are looking for files on your memory device. Near the bottom where it says "SPSS (*.sav)," click on the little triangle then go down the list and select "Excel (*.xls)." In the list of files, click on "nhdata.xls." When the "Open Excel Data Source" window appears, click "OK." The data should then appear in the SPSS Data View. Add variable and value labels, then save the data file as "xls.sav".
Reading Data from a Database: Finally, find and open "nhdata.dbf" to look at the dBASE IV database. Note that column headings are provided in the data base file. Close the database viewer when finished. Open SPSS, click on "File" then "Open Database" then "New Query." You are now in the "Database Wizard." Click "Add Data Source." From the list, select "dBASE Files," then click "Configure." Click "Select Directory," then use the down triangle to select the storage device you are using. In the folders list, select the folder where the database file is stored. Click "OK" three times until you are back at the "Database Wizard." Click "Next." From the "Available Tables" list, click and drag "nhdata" to the "Retrieve Fields in this Order" list. Once the list of variables appears, click "Finished." The data should then appear in the SPSS Data View. Add variable adn value labels as required then save the data file as "dbf.sav". You may also open a database file using the same procedure used to open the Excel spreadsheet. However, you will need delete the extra D_R variable this process creates.
What to Turn In: When you have completed the assignment, turn in your storage device containing three SPSS data files, "txt.sav," "xls.sav," and "dbf.sav" on the due date announced in class.