2

Instead of commenting in and out large blocks of code when developing, I am looking for an equivalent to the stop statement outside a data step which stops a SAS script at a certain point, ideally without throwing an error, nor setting brackets, nor defining own macros. All I found as minimal workaround is something like the following:

%put --- This is code I would like to execute;

data _null_;
   abort cancel file;
run;

%put --- This is code which should temporarily disabled;

Is there a shorter or cleaner solution (in terms of log-output) how to stop executing a SAS script without quitting SAS altogether?

Related questions

B--rian
  • 5,578
  • 10
  • 38
  • 89

1 Answers1

1

Create one macro stop_submission

%macro stop_submission;
  %abort cancel;
%mend;

Sample use:

%macro stop_submission;
  %abort cancel;
%mend;



data one;
  set sashelp.class;
run;

%stop_submission

data two;
  set sashelp.class;
run;

data three;
  set sashelp.class;
run;

Will log something like

29167  data one;
29168    set sashelp.class;
29169  run;

NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: The data set WORK.ONE has 19 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds


29170
29171  %stop_submission

ERROR: Execution canceled by an %ABORT CANCEL statement.
NOTE: The SAS System stopped processing due to receiving a CANCEL request.
Richard
  • 25,390
  • 3
  • 25
  • 38