pspp-users
[Top][All Lists]
Advanced

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

Fw: Re: Import CVS with carriage return inside double quotes


From: Matteo Ga
Subject: Fw: Re: Import CVS with carriage return inside double quotes
Date: Fri, 22 Feb 2019 22:45:44 +0100

 
I'm discussing this issue with Alan.
Sent: Friday, February 22, 2019 at 10:04 PM
From: "Matteo Ga" <address@hidden>
To: address@hidden
Subject: Re: Import CVS with carriage return inside double quotes
Thank you for the suggestion.
 
The file is not a true cvs because the delimiter are TABS.
 
I tried adding the QUALIFIER (actually I already used it on the GUI) but the result is the same. 
 
I attach the output and warnings.
 
it seams that the parser simply doesn't skip over the <CR>, as it should, even if they are inside double quotes.
 
Thank
 
 
Sent: Friday, February 22, 2019 at 7:15 PM
From: "Alan Mead" <address@hidden>
To: "Matteo Ga" <address@hidden>, address@hidden
Subject: Re: Import CVS with carriage return inside double quotes
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.txt
Description: Text document

Attachment: pspp.jnl
Description: Binary data


reply via email to

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