.CSV Import Infile Delimiter

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 133
Accepted Solution

.CSV Import Infile Delimiter

Hi,

 

I got .csv data in the format of

 

"xxxxx, dddd","fffff; dddd","bbbb"

"x11xx, d3dd","f2ff; dd2d","b33b"

 

I basically need to import anyhting that is between the "  " and seperated by comma.

 

column_A              column_b              column_c

xxxxx, dddd            fffff; dddd               bbbb

x11xx, d3dd           f2ff; dd2d               b33b

 

I struggle to find the right delimiter and the import wizard in SAS does not give me the right one either.

 

','x does not work

 

    INFILE '...csv'
        LRECL=219
        ENCODING="WLATIN1"
        TERMSTR=CRLF
        DLM=','x
        MISSOVER;


Accepted Solutions
Solution
‎05-19-2016 03:45 AM
Super Contributor
Posts: 308

Re: .CSV Import Infile Delimiter

[ Edited ]

Hello,

 

data want;
infile "/DW_RAPS/Interfata/WORK/Andrei/macros/import.txt" DLMSTR='","' missover;
input a :$50. b :$50. c :$50.;
/*eliminate quotes from first and last variables*/
a=compress(a,'"');
c=compress(a,'"');

run;

 

run;

View solution in original post


All Replies
Solution
‎05-19-2016 03:45 AM
Super Contributor
Posts: 308

Re: .CSV Import Infile Delimiter

[ Edited ]

Hello,

 

data want;
infile "/DW_RAPS/Interfata/WORK/Andrei/macros/import.txt" DLMSTR='","' missover;
input a :$50. b :$50. c :$50.;
/*eliminate quotes from first and last variables*/
a=compress(a,'"');
c=compress(a,'"');

run;

 

run;

Super User
Posts: 9,878

Re: .CSV Import Infile Delimiter

Add DSD option into it .

Super User
Super User
Posts: 7,727

Re: .CSV Import Infile Delimiter

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 310 views
  • 0 likes
  • 4 in conversation