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

Hi there!
I'm trying to read in text file with "End of Media" special character in the middle of the file and SAS read all the data before that character only - is there any possibility to read in the whole file?

data TEST;
  infile "test.txt" truncover;
  length REC $400;
  input REC 1-400;
  LINE=_N_;
run;

File contain more than 40k records and in dataset I get only first 3000 records, the last one is the string with EM character in the middle of the string, so I see this first part of the string in the last record...
Are the any options to read text file line by line including special characters like "End of Media" or maybe to tell SAS to not use EM as EoF marker?

Here is what Notepad++ shows when I'm looking into the file - please see 3rd line - there are some special characters in the line and one of them is EM which makes SAS to stop reading the data:

saskaan_0-1701094528063.png

And what I get in dataset:

saskaan_0-1701094812442.png

 

Thanks,
Anton.


1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Use the IGNOREDOSEOF option on the INFILE statement.  Or when defining the fileref using a FILENAME statement.

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

Use the IGNOREDOSEOF option on the INFILE statement.  Or when defining the fileref using a FILENAME statement.

saskaan
Calcite | Level 5
Yep, it works! Thanks a lot!

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 553 views
  • 0 likes
  • 2 in conversation