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

Hi All:

Not sure whether to post in this forum, but it seems the best fit.

I am running the following code reading a not too large file:

  data work01;

  infile "my\file\name.txt"   lrecl=400 pad missover end=eof;

  input @001 var01 $char400.; 

There is a lot of "bad" data in the file - commas, special characters, etc.

My problem is that when a single quote appears in the data (as in the name: O'Leary) the read seems to stop

at that point and I get no more data.  This is only about half way through the data.

There is no indication in the log that any problem was encountered.

Any ideas how I can get past this?  I need to keep the data as it is (bad characters and all) for the output.

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
data_null__
Jade | Level 19

Maybe you need INFILE statement option IGNOREDOSEOF.

View solution in original post

5 REPLIES 5
data_null__
Jade | Level 19

Maybe you need INFILE statement option IGNOREDOSEOF.

OS2Rules
Obsidian | Level 7

Correct on the first try!

Wonder why this option has anything to do with what I assume is quoted text?

data_null__
Jade | Level 19

It is not a quote just look like it.  Use LIST statement and if it is unprintable control character it will show the line in HEX and you can see what the character actually is.

TomKari
Onyx | Level 15

I have often hit problems where someone has used a document editor like Microsoft Word to prepare data. Word will automatically change many characters, for instance the double quote " character to what it calls smartquotes, which have different open and close characters. SAS frequently coughs up a hairball when it sees these.

Tom

Doc_Duke
Rhodochrosite | Level 12

The control character was probably a  (ctrl-Z).  Back in the days of DOS, and version 6 of PC SAS, that was still in use and has been maintained in SAS as an EOF character of for PC SAS since.  SAS will read most other control characters into a character variable.

Doc Muhlbaier

Duke

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

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 5 replies
  • 1838 views
  • 0 likes
  • 4 in conversation