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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 1109 views
  • 1 like
  • 2 in conversation