BookmarkSubscribeRSS Feed
Rups_b
Calcite | Level 5

How can I read these two files with several types of delimiters?

2 REPLIES 2
ballardw
Super User

The DLM option on an infile statement will take multiple characters.

 

However every time any of those characters are encountered it will be treated as a delimiter. So if those characters have any other use in some place in the file you need to be very explicit about parsing rules.

data example;
   infile datalines dlm="~/\|&:-*=,_'";
   informat id $5. Name $10. value best10.;
   input id name value;
datalines;
101~lily\5000
102&jasmine|3000
103:rose/7000
101-lily*5000
102=jasmine,3000
103_rose'7000
;

If someone has both single and double quotes the '   and " as delimiters then you are going to need the DLM string to use the "enter two quotes to be used as one" that is very old school coding:

dlm="~/\|&:-*=,_'"""

 

 

 

Please, for just a few lines of text copy and paste into a text box opened on the forum with the </>.

Note: Anybody sending me a file with that kind of "delimiters" is likely to be met with severe disapproval.

 

Rups_b
Calcite | Level 5
Thank you. I will surely remember that.