DATA Step, Macro, Functions and more

Abort

Reply
Super Contributor
Posts: 647

Abort

data _null_;
set x;
if (input(substr(dat,1,2),8.) > 12
or
input(substr(dat,4,2),8.)> 31
)
then error = 'Y';
if error = 'Y' then abort;
put 'ERROR:Error in the date field.Correct the date field in the source data';
run;

I forced values where month is greater than 12 and day is greater than 31.The process did not stop (abort).It processed further.
Super Contributor
Super Contributor
Posts: 3,174

Re: Abort

First, I encourage you to enhance your data validation by converting the character date-string to a SAS numeric DATE variable where SAS will validate the data more accurately during the INPUT function processing, the test the _ERROR_ variable for non-zero before you do some exception action.

For your particular post/query, you will want to read the specific OS companion guide about how ABORT works in your particular OS, also considering such OPTIONS as ERRORABEND/NOERRORABEND.

Scott Barry
SBBWorks, Inc.
Ask a Question
Discussion stats
  • 1 reply
  • 104 views
  • 0 likes
  • 2 in conversation