IGNOREDOSEOF Option

From sasCommunity
Jump to: navigation, search

On the Windows platform, the presence of the ASCII hexadecimal 1A character can cause SAS to stop processing. The remainder of the record containing the killer character, and all subsequent records, are simply ignored.

This behavior comes from the days of DOS, where hex 1A was an end-of-file sentinel and could be entered from the keyboard with the Control-Z key combination. It's now somewhat hard to enter the character unintentionally, since most Windows apps intercept Control-Z as a shortcut for Edit>Undo. It has been reported on SAS-L that EBCDIC files imported from mainframe systems may contain trouble-causing 1A characters.

The IGNOREDOSEOF can force SAS to treat the 1A character as simply part of the data stream. Here is a demonstration. First create the problem:

data _null_;
file demo;
put 'ab' / 'c' '1A'x 'd' /'ef';
run;

Try reading the file:

data _null_;
infile demo;
input;
put _infile_ @5 _infile_ $hex6.;
run;

Result:

ab  6162
c   63

Now do it with the option:

data _null_;
infile demo ignoredoseof;
input;
put _infile_ @5 _infile_ $hex6.;
run;

Result:

ab  6162
c�d 631A64
ef  6566

IGNOREDOSEOF can also be used on the %INCLUDE statement.