« Variable Lists | Main | Anonymizing medical data »

January 29, 2013

Debugging in SAS

I'm working through some tutorials and this seems to be an important topic.

putlog _all_; *prints the current pdv (working data row) to the log;

the _ERROR_ variable increments to one if a syntax error occurs. You can use conditional logic to output variable information to the log.

putlog 'WARNING: blah blah'; * will colorcode the output

data customers /debug; *will enter debug mode;

- doesn't work with SAS Enterprise Guide

Step - goes to nex step
Watch or W [variable] - auto-print variable value when it changes
Deletewatch or DW [variable]
Examine or E [variable] - print a variable value
$ examine varible $quote7. - print variable within quotes and up to 7 characters
List or L [_All_ Files Break INFILES Datasets WATCH] - print all items within the specified option
Set [variable] = [value] - change a variable value

List or L

set [dataset] END=last; * when the data step cycles through the last observation of the dataset 'last' will be set to one. Conditionals can be added to do something special upon reaching the last row;

Posted by kkwaiser at January 29, 2013 11:54 AM


Login to leave a comment. Create a new account.