BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
RandyW
Calcite | Level 5

Newer EG user here and I am trying to import a .DAT file where the Field delimiter is ~##~ and Record delimiter is ~@^*^@~

In EG, the Delimited Fields "Other" option appears to only allow one character. 

Does anyone know if this delimiter type is possible?

Thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions
TomKari
Onyx | Level 15

Now THAT's funky data!

 

I took at quick look at EG, and I don't see a way.

 

Are you experienced enough with the SAS tools to write some SAS code and run it in a program node in EG? Doing something like this is trivial with the underlying SAS programming language.

 

Another option I can think of is to use something like Notepad to convert all of your multi-character delimiters to a single character. ~ and | are popular, just make sure first that whatever it is doesn't appear in the dataset already.

 

Tom

View solution in original post

4 REPLIES 4
Tom
Super User Tom
Super User

Are you really trying to read a WORD file?  If not can you post some of the data as text instead of as WORD attachment.  If you just pasted a photograph of your data into the WORD file then post the photograph directly into your posting instead.

You can use a simple data step to see what is in the file. Something like:

data _null_;
  infile 'myfile.dat' obs=3;
  input;
  list;
run;

Or perhaps you want to treat it as a binary file since you apparently have "records" instead of "lines".  In that case you might just read the first few hundred bytes of the file. Say 300 bytes in blocks of 100 each.

data _null_;
  infile 'myfile.dat' recfm=f lrecl=100 obs=3;
  input;
  list;
run;

 

TomKari
Onyx | Level 15

Now THAT's funky data!

 

I took at quick look at EG, and I don't see a way.

 

Are you experienced enough with the SAS tools to write some SAS code and run it in a program node in EG? Doing something like this is trivial with the underlying SAS programming language.

 

Another option I can think of is to use something like Notepad to convert all of your multi-character delimiters to a single character. ~ and | are popular, just make sure first that whatever it is doesn't appear in the dataset already.

 

Tom

RandyW
Calcite | Level 5

great idea, thank you

ballardw
Super User

Here's a suggestion that may get you something that works for that file:

 

Post some example text in a code box opened on the forum with the {I}. The picture you posted does not include an actual example of your end of record appearance. The example doesn't need to contain any sensitive values and would be a good idea to contain at least 3 records so we can see two or more "end of record"

 

Code would be needed but he field delimiter can be addressed with the DLMSTR option on an infile statement:

data example;
   infile datalines dlmstr="~##~";
   input a $ b c;
datalines;
abc~##~1.23~##~999
;

 

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1498 views
  • 0 likes
  • 4 in conversation