Reading CSV Files
To read CSV files, from the menus choose:
Note: The Import Data function does not support CSV data that includes
embedded line breaks in quoted text. A possible workaround is to save the CSV file (that includes
quoted embedded line breaks) as an .xls/.xlsx file, and then use the import
Excel feature.
The Read CSV File dialog reads CSV format text data files that use a comma, a semicolon, or a tab as the delimiter between values.
If the text file uses a different delimiter, contains text at the beginning of the file that is not variable names or data values, or has other special considerations, use the Text Wizard to read the files.
- First line contains variable names
- The first non-blank line in the file contains label text that is used as variable names. Values that are invalid as variable names are automatically converted to valid variable names.
- Remove leading spaces from string values
- Any blank spaces at the beginning of string values are removed.
- Remove trailing spaces from string values
- Blank spaces at the end of the string values are removed. This setting affects the calculation of the defined width of string variables.
- Delimiter between values
- The delimiter can be a comma, a semicolon, or a tab. If the delimiter is any other character or a blank space, use the Text Wizard to read the file.
- Decimal symbol
- The symbol that is used to indicate decimals in the text data file. The symbol can be a period or a comma.
- Text Qualifier
- Character that is used to enclose values that contain the delimiter character. The qualifier appears at the start and the end of the value. The qualifier can be double quotation mark, single quotation mark, or none.
- Percentage of values that determine data type
- The data type for each variable is determined by the percentage of values that conform to the
same format.
- The value must be greater than 50.
- If no consistent format is used by the specified percentage of values, the variable is assigned the string data type.
- For variables that are assigned a numeric format (including date and time formats) based on the percentage value, values that do not conform to that format are assigned the system-missing value.
- Cache data locally
- A data cache is a complete copy of the data file that is stored in temporary disk space. Caching the data file can improve performance.