Troubleshooting Problems Reading Delimited ASCII (.csv) Files

Troubleshooting Problems Reading Delimited ASCII (.csv) Files

Stat/Transfer is set up to easily and automatically read ASCII files similar to those that are written by Excel, the de facto standard for these files.  However, if your file was written by any software other than Excel, you might need to change some options.

It is always a good idea to look at your file in a capable editor, and note the following:

  1. What delimiter is used between fields (Stat/Transfer will fairly reliably auto-sense the delimiter, but it will do no harm to set it manually yourself

 

  1. Are Strings Quoted?  If so, what character is used?  If Strings are not quoted, and you have quotes in your data, you will need to set your quote character to blank.

 

  1. Are the data uniform from top to bottom.  Stat/Transfer, by default will read the first one thousand cases to determine how to read each field.  If this is not enough, you might want to specify “all” or at least a higher number.

 

  1. If there are variable names in the first row, are there any numeric data in the file?  If not, variable name autosensing will not work and you will need to specify that there are variable names in the file explicitly.

 

  1. Are strings properly formed?  To quote from the specification:

Fields containing line breaks (CRLF), double quotes, and commas should be enclosed in double-quotes.  For example:

 

      "aaa","b CRLF

      bb","ccc" CRLF

      zzz,yyy,xxx

 

If double-quotes are used to enclose fields, then a double-quote appearing inside a field must be escaped by preceding it with another double quote.  For example:

 

      "aaa","b""bb","ccc"

 

Because Stat/Transfer will handle line breaks within quoted strings, mismatched quotes can cause no end of mischief, such as lots of missing data and missing records.  If this is your problem, look at your file!

 

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.