SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Understanding DATA Step Processing
Debugging a DATA Step


Keep in mind that not all misspelled keywords are interpreted by SAS software. For example, the DATA step shown below contains two syntax errors:
  • INFILE is misspelled as UNFILE
  • a semicolon is missing.
     data perm.update;
        unfile invent <-- missing semicolon
        input Item $ 1-13 IDnum $ 15-19
              InStock 21-22 BackOrd 24-25;
        Total=instock+backord;
     run;

When you submit this step, SAS software cannot interpret the first syntax error, the misspelled keyword. As a result, an error message appears in the SAS log. Because the DATA step does not execute, the data set contains zero observations.


SAS Log
07  data perm.update;
08     unfile invent
       ------
       180
ERROR 180-322: Statement is not valid or it
               is used out of proper order.
09     input Item $ 1-13 IDnum $ 15-19
10           InStock 21-22 BackOrd 24-25;
11     Total=instock+backord;
12  run;

NOTE: The SAS System stopped processing this step
      because of errors.
WARNING: The data set PERM.UPDATE may be incomplete.
         When this step was stopped there were
         0 observations and 3 variables.


The second syntax error, the missing semicolon, causes the INPUT statement to be read as invalid INFILE statement options. So, the variables defined in the INPUT statement are not assigned spaces in the program data vector, and they are not written to the descriptor portion of the data set.

However, the three variables specified in the assignment statement (Total, InStock, and BackOrd) are assigned spaces in the program data vector and are written to the descriptor portion of the data set.


back||next


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

Terms of Use & Legal Information | Privacy Statement