Thu 13 Mar 2014 01:15:39 PM UTC, original submission:
SPSS sav files may contain line breaks as cell content.
When exporting to .csv, these are exported "as is",
that is I find DOS line breaks (CR-LF) in Table cells,
even though the table itself is written to linux file
format (only LF as line breaks).
The export is done using
GET FILE="source.sav"
SAVE TRANSLATE
/TYPE=TAB
/FIELDNAMES
/OUTFILE="pspp_out.csv"
An example file can be downloaded from (needs registration):
https://dbk.gesis.org/dbksearch/download.asp?db=D&id=35706
The file's third row contains a Dos line break:
<foo> "FRAGEBOGEN GEMEINSAM MIT MEINER MUTTER AUSGEFÜLLT, DA ICH EINIGE FRAGEN OHNE IHRE UNTERSTÜTZUNG NICHT HÄTTE BEANTWORTEN KÖNNEN. Z.B. WOHNUNG^M
" <bar>
A newline is introduced, and a ^M denoting a carriage return is
trailing at the end of line.
All instances of cells containing line breaks I encountered are actually cut-and-paste accidents, none of them serves a layout purpose.
In my opinion, the export to csv should not export the line breaks at all, as it screws up the table geometry (one line per case containing all columns). Handling the csv with the
standard unix tools (cut, paste, grep..) will not work as expected. But that really is just my opinion :-)
If the line breaks are exported, they should match the current file encoding, though. So in this case, Unix line feeds should be written instead of DOS ones.
I post this bug following up on my inquiry to pspp bugs mailing list of 2014-03-12, with the subject "PSPP-BUG: DOS Linebreaks in Table Cells: Intentionally exported?"
|