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.

SAS Innovate 2025: Call for Content

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!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 607 views
  • 1 like
  • 2 in conversation