I am trying to make a SAS JOB fail. I need a way to make a job fail if the last table has no columns. How can I do this? I made a user transform with one input and no output, I can count the rows, but can't find a way to make an error of it.That is I can make an error but it happens even when there are multiple rows in the table. I used ABORT way to stop it, but this does not generate an error. But the user tranform wont let me use my macro for sending mail in this case. So then I need an error as this generates an error mail.
To start, you are working with the SAS macro language. So you will need to consider coding a SAS macro with %IF %THEN %DO %END (possibly) and use the %ABORT statement. Or as was mentioned, conditionally execute a SAS DATA step to generate a more meaningful output message to the SAS log and then execute an ABORT ABEND statement.
Also, in addition to the recommended DOC reading below, you may find additional info in the SAS companion guide for your Operating System, where ABORT is further discussed for your OS.