

Even if your workbook only has a single sheet, you must still tell SPSS which sheet you want to read in. The /SHEET=name '' line tells SPSS which sheet of the workbook to read in.
#How to use spss 23 full#
The path should use backslashes (\), and should include the full name of the file (including its extension) after the last backslash. The /FILE='' line tells SPSS the exact location of the file on your computer (which goes between the quotation marks).
#How to use spss 23 code#
The most important lines in this code are /FILE='' and /SHEET=name ''. If you are reading an *.xls file, use /TYPE=XLS. Note: If you are importing an *.xlsx file, use /TYPE=XLSX. The general syntax is: GET DATA /TYPE=XLSX Here is an example of how sample data appear in SPSS once the data have been imported:Īlternatively, you can import Excel files into SPSS using syntax, instead of using the dropdown menus. The Maximum width for string columns option determines how wide a string variable should be it is suggested to keep the default value unless you have a reason for altering it. The meaning of Read variable names from the first row of data checkbox, the Worksheet dropdown, and the Range box are the same as above.

If you are using SPSS version 24 or earlier, you will instead see the Opening Excel Data Source window: It is suggested to keep the default value unless you have a reason for altering it. You may also specify the range of rows/columns to import if you wish.

This is optional, but is often convenient, since leading and trailing spaces can appear invisible to the user, but cause SPSS to think that otherwise identical strings are distinct. The former will remove any whitespace characters that appear at the start of the string, and the latter will remove any whitespace characters at the end of the string. The options Remove leading spaces from string values and Remove trailing spaces from string values only affect variables that are imported as strings.If your variable names are in the first row of data, select the Read variable names from the first row of data check box.(If you have not assigned names to the sheets in your Excel workbook, the labels you see here will usually be Sheet1, Sheet2, Sheet3, etc.) You can only import one sheet from your Excel file at a time.

