tech bitz
tech bitz

Reputation: 11

SAS Invalid data for csv

Im quite new to SAS and after many attempts Im still wondering how could import my csv file into SAS accurately.

Here's my data

color, Description, price
"Black, blue, grey", "Pipe, 16" inch wide, PVC", 20.27

Here's my sas code

PROC IMPORT datafile='/home/..data.csv'
            out=data dbms=csv replace; 
            getnames=yes;
            guessingrows = max;
RUN; 

Here's what SAS reads:

Color                 Description      Price 
Black, blue, grey     "Pipe             .

I suspect SAS treat "Pipe under description instead of Pipe, 16" inch wide, PVC. What could I do so that SAS can read the whole line?

Upvotes: 0

Views: 701

Answers (1)

Richard
Richard

Reputation: 27518

The csv data is invalid.

The 'desired' double quoted value Pipe, 16" inch wide, PVC contains both a double-quote (") and the value separator (,). Some CSV readers will parse correctly if the 16" has an escaped " as 16"". However, SAS IMPORT appears to be not one of those.

Can you get the data with an alternate field delimiter such as | or ~?

Upvotes: 2

Related Questions