SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Debugging and Testing DATA Steps
Debugging a DATA Step


Diagnosing Execution-Time Errors

Most execution-time errors produce warning messages but allow the SAS program to continue executing. Note: If you process a DATA step in noninteractive mode, execution-time errors may cause the program to stop processing.

Continuing with a version of our previous example, notice the mistake in a variable name:

     data annual;
        set finance.loans;
        Interest=ammount*rate;
     run;

After submitting the program, the DATA step compiles successfully but errors are detected during the execution phase. The first note informs you that the variable Ammount is uninitialized.


The SAS Log window displays error message.

This note is generated because SAS does not recognize the variable name. The variable Ammount is reported as uninitialized because it is originally set to missing and, during the execution of the DATA step, the value is never changed.

By referring to the Loans data set (below), you notice that the variable name Amount is misspelled in the DATA step. Because the misspelled word conforms to the rules of a SAS variable name, it is not reported as an error. Even so, log notes help you locate spelling or logic errors.


Description of Finance.Loans
Variable Length
Account $8
Amount 8
Rate 8
Months 8
Payment 8


The second note tells you what action has been taken. Notice that the message also reports that nine missing values were generated and that the operation occurred at line 7 of column 17 of the log report.

The SAS Log window indicates error location.

The last note indicates that the error has not stopped the execution of the DATA step. The new data set is created and contains nine observations, even though some values are missing.


back||next


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

Terms of Use & Legal Information | Privacy Statement