SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Understanding DATA Step Processing
Debugging a DATA Step


Diagnosing Syntax Errors

Now that you know how a DATA step is processed, let's use that knowledge to debug some errors. For example, suppose you have syntax errors in your DATA step.

In the example below, the keyword DATA is misspelled. When the DATA step is submitted for processing, the misspelled word is interpreted as "DATA" and the DATA step compiles successfully. SAS software underlines the detected error, identifies it with a number, and writes a corresponding message in the log.

     daat perm.update;
        infile invent;
        input Item $ 1-13 IDnum $ 15-19
              InStock 21-22 BackOrd 24-25;
        Total=instock+backord;
     run;

SAS Log
07  daat perm.update;
    ----
    14
WARNING 14-169: Assuming the symbol DATA
                was misspelled as daat.
08     infile invent;
09     input Item $ 1-13 IDnum $ 15-19
10           InStock 21-22 BackOrd 24-25;
11     Total=instock+backord;
12  run;


Note that SAS software does not correct the misspelled word in your program. You must correct the error in your program before submitting it again.

If no syntax errors are detected or if SAS software can interpret the syntax errors, the DATA step compiles and then executes. If SAS software cannot interpret the syntax errors, the DATA step compiles, but does not execute.


back||next


Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.

Terms of Use & Legal Information | Privacy Statement