Hi,
I am faicng an issue while reading Pipe delimeted file. there is a single quotes in between two field due to which its getting clubed together in one field.
Input data
123456789|'|9820 SW 120TH ST| |
OUTPUT DATA
123456789 |9820 SW 120TH ST| |
i am using below code
DATA NEW;
LENGTH ACCOUNT $16. addr_1 $30. addr_2 $30. addr_3 $30. addr_4 $30. ;
INFILE "/filelocation/test.txt" DSD DLM='|' ;
INPUT ACCOUNT addr_1 addr_2 addr_3 addr_4 .$ ;
RUN;
Highlighted one getting combined into one.
can anyone please suggest me how to handle it. and I am not sure which row and column can have this value.
Thanks
Remove DSD option
In your output data set, which variable should hold the value:
9820 SW 120TH ST
Would it make a difference if this variable were shifted over, and became the value of ADDR_1?
Would single quotes ever appear anywhere else within your data, other than in the characters |'| ?
Hi @PravinMishra,
I cannot replicate your issue:
DATA NEW;
LENGTH ACCOUNT $16 addr_1 $30 addr_2 $30 addr_3 $30 addr_4 $30;
INFILE cards DSD DLM='|' ;
INPUT ACCOUNT addr_1 addr_2 addr_3 addr_4;
cards;
123456789|'|9820 SW 120TH ST| |
;
Result:
ACCOUNT addr_1 addr_2 addr_3 addr_4 123456789 ' 9820 SW 120TH ST
(Same result when reading from an external file.)
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.