Ronald H. Heck 1 Preparing IBM SPSS Data and MS Excel Files for Conducting Mplus Analyses Lynn N. Tabata IBM SPSS and Excel data files (.sav and.xls) may be exported to one of several file formats that can then be read by Mplus software. Some of the common file formats used include:.dat (Fixed ASCII, Tab-delimited), and csv (comma separated values). A few guidelines governing preparing data files that are readable in Mplus include: 1. Variable names should be excluded from the first line of the exported file; 2. Use the Save As file option and available options to determine the format of exported data file; 3. Files exported using a Fixed ASCII (.dat) format require having a Format is syntax line in Mplus; 4. Files exported using delimiters (e.g., tabs, commas, spaces) are a free format and omits the necessity of declaring a Format is syntax line in Mplus. The following examples illustrate exporting data files from IBM SPSS and Excel in.dat (Fixed ASCII, Tab-delimited) and.csv (comma separated values) formats. Example 1: Fixed ASCII (.dat) Exporting Data Files from IBM SPSS A Fixed ASCII file is where each of the data values in each row have the same or fixed column length.
Ronald H. Heck Preparing IBM SPSS Data and MS Excel Files 2 (Launch the IBM SPSS application program and select the employee.sav data file.) 1. Go to the toolbar, select SAVE AS. This command opens the Save Data As main dialog box. 2a. Within the Save Data As dialog box locate the folder where the file will be saved. b. In the Save as type option click the pull-down menu and select: Fixed ASCII (*.dat). c. The file will use the same name (employee) but with a.dat extension. If you wish to change the file name you may do so by typing in the desired name. Note: Saving the file in Fixed ASCII format automatically removes variable names from the exported file. This differs from other methods where you must deselect having variable names written-out to the exported file. Click SAVE to generate the employee.dat file.
Ronald H. Heck Preparing IBM SPSS Data and MS Excel Files 3 3. IBM SPSS also generates output about the exported file. The Format column provides information to be listed in the Mplus FILE command syntax line. From the output we can see that there are 4 variables having 8.0 so the format is: 4f8.0. Example 2: Tab delimited (.dat) A tab-delimited file is where the data values in each row are separated by a delimiter character which in this case are tabs. Data files which use delimiters are considered a free format and are not defined in the Mplus DATA syntax as shown at the end.
Ronald H. Heck Preparing IBM SPSS Data and MS Excel Files 4 Repeat step 1 in Example 1to access the Save Data as dialog box. 2a. Within the Save Data As dialog box locate the folder where the file will be saved. b. In the Save as type option click the pull-down menu and select: Tab Delimited (*.dat). c. We do not want the variable names to be included in the exported.dat file so uncheck the Write variable names to spreadsheet option. d. The file will use the same name (employee) but with a.dat extension. If you wish to change the file name you may do so by typing in the desired name. Click SAVE to generate the employee.dat file. Since a tab-delimited file has a free format, no Format line in Mplus is needed:
Ronald H. Heck Preparing IBM SPSS Data and MS Excel Files 5 Example 3: Comma Separated Values (.csv) A comma-delimited file is where the data values in each row are separated by a delimiter which in this case are commas. Data files which use delimiters are considered a free format and are not defined in the Mplus DATA syntax as shown at the end. Repeat step 1 in Example 1 to access the Save Data as dialog box. 2a. Within the Save Data As dialog box locate the folder where the file will be saved. b. In the Save as type option click the pull-down menu and select: Comma Delimited (*.csv). c. We do not want the variable names to be included in the exported.csv file so uncheck the Write variable names to spreadsheet option. d. The file will use the same name (employee) but with a.csv extension. If you wish to change the file name you may do so by typing in the desired name.
Ronald H. Heck Preparing IBM SPSS Data and MS Excel Files 6 Click SAVE to generate the employee.csv file. Since comma separated values file has a free format, no Format line in Mplus is needed : Exporting Data Files from MS Excel MS Excel offers a variety of delimited formats (e.g., comma, tab, space) from which to generate a readable file for Mplus. Since the procedure for each format follows similar steps we will illustrate just the.csv format. Note the key difference when working with an Excel file is to delete variable names from the first line. Example: CSV (Comma Separated Values) (Launch the MS Excel application program and select the employee.xls data file.) 1. Mplus data files omit variable names so we must first remove the names from the Excel file. Click to select and highlight the first row then right-click to display a submenu and select Delete. Note: An alternative method is to select the row then in the Home 1 tab s Cells section select Delete > Cells. 1 MS Excel 2007 and 2010.
Ronald H. Heck Preparing IBM SPSS Data and MS Excel Files 7 2. Now that the variable names have been removed we may save the file in the desired format. Click the FILE tab to access the Save File options. 3. Click to select SAVE AS which will display the Save As dialog box.
Ronald H. Heck Preparing IBM SPSS Data and MS Excel Files 8 4a. Within the Save Data As dialog box locate the folder where the file will be saved. b. In the Save as type option click the pull-down menu and select: CSV (Comma Delimited). c. The file will use the same name (employee) but add a.csv extension to the file. If you wish to change the file name you may do so by typing in the desired name. Click the SAVE button. d. A warning message about potential compatibility issues but click YES. Since comma separated values file has a free format, no Format line in Mplus is needed: