09-27-2012 11:49 AM
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:
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.
09-28-2012 01:18 PM
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.
09-29-2012 02:55 PM
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.
Need further help from the community? Please ask a new question.