pspp-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Import CVS with carriage return inside double quotes


From: Alan Mead
Subject: Re: Import CVS with carriage return inside double quotes
Date: Fri, 22 Feb 2019 12:15:57 -0600
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0

Matteo,

You replied back to me:

First of all sorry for my too short question I'll try to be more specific.
 
I run PSPP 1.0.1 on Ubuntu 18.04 And I'm tryng to import a file where some character fields are delimited by doubles quotes if they contains <CR>.
 
That <CR> should not be treated as record terminator but that's just what happens.
 
I've attached a reduced sample of the fil: the last record if treated as 2 field instead of one.

And:

Libreoffice Calc import the file without problem

And included the attached file (which I've renamed to have a .csv extension). You reported that it opens fine in LibreOffice Calc, but when I import it, I get the same, incorrect, results:


The problem inherent in CSV (comma separated values) is that it's not really a format. When I examine your file, it's clearly not using comma's to separate values:



I think it would be fastest to fix your data, but it looks like PSPP supports "qualifiers" when reading delimited data and you could play with that to see if you can coax PSPP into reading the file correctly:

9.4.3.1 Reading Delimited Data

GET DATA /TYPE=TXT
        /FILE={’file_name’,file_handle}
        [/ARRANGEMENT={DELIMITED,FIXED}]
        [/FIRSTCASE={first_case}]
        [/IMPORTCASE={ALL,FIRST max_cases,PERCENT percent}]

        /DELIMITERS="delimiters"
        [/QUALIFIER="quotes"
        [/DELCASE={LINE,VARIABLES n_variables}]
        /VARIABLES=del_var1 [del_var2]…
...

The optional 
QUALIFIER subcommand names one or more characters that can be used to quote values within fields in the input. A field that begins with one of the specified quote characters ends at the next matching quote. Intervening delimiters become part of the field, instead of terminating it. The ability to specify more than one quote character is a PSPPextension.

If you go that route and have trouble, posting your syntax would be most helpful.

-Alan

On 2/22/2019 11:15 AM, Matteo Ga wrote:
I'm a newbie on PSPP.
Today I tryed to import a CVS but got a problem when the parser encountered a <CR> inside double quotes.
 
I cannot link the file since contain reserved data.
 
Any Help?
 
Thank You

_______________________________________________
Pspp-users mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/pspp-users

-- 

Alan D. Mead, Ph.D.
President, Talent Algorithms Inc.

science + technology = better workers

http://www.alanmead.org

"You're an interesting species. An interesting mix. 
You're capable of such beautiful dreams, and such 
horrible nightmares. You feel so lost, so cut off, 
so alone, only you're not. See, in all our 
searching, the only thing we've found that makes 
the emptiness bearable, is each other."

-- Carl Sagan, Contact

Attachment: nocr.csv
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]