Tuesday, February 3, 2009

defensive programming when using multiple INPUTs

When there are more than one INPUT statements in DATA step, we should care about end-of-file issue. Before INPUT, we should check the enf-of-file to avoid DATA step execution stop.

It should be something like below:

infile in end=end; *or eof= option;
input;
* something here;
if not end then do;
input;
* something here ;
end;
* something here;

if end then do;
* something here;
end;

No comments: