.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: 305

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: 305

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;

Grand Advisor
Posts: 9,584

Re: .CSV Import Infile Delimiter

Add DSD option into it .

Esteemed Advisor
Esteemed Advisor
Posts: 7,232

Re: .CSV Import Infile Delimiter

☑ This topic is SOLVED.

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

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