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.
Maybe you need INFILE statement option IGNOREDOSEOF.
Maybe you need INFILE statement option IGNOREDOSEOF.
Correct on the first try!
Wonder why this option has anything to do with what I assume is quoted text?
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.
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
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
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!
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.