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.)
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.