12-10-2013 09:08 AM
I have a program that I run with a variety of parameters. For certain choices of parameters, I want a condition in the beginning of my program that says that the program should stop executing immediately, thus not completing all the following data steps and macro functions, but without printing an error message to the log.
The abort statement works, but it prints an error message to the log.
So I would like something in the lines of:
%if ¶meter. = 1 %then %do;
<command that stops the program from running, but doesn't print an error>
<rest of huge program>
I would like to avoid having to wrap the entirety of the rest of the program in a large macro. Any ideas are appeciated.
12-10-2013 10:31 AM
Thanks, I have also had a look at endsas;.
It prints no error message to the log, but it closes SAS entirely. I am hoping for something that stops the program, but leaves SAS open.
12-10-2013 10:51 AM
You may want a %goto statement that branches to a place in your macro that has no code executing afterwards. That may require a macro to surrround all of your existing code for the logic to work.
%macro control(<parameters needed>);
<start of code>
/*at problem location*/
%if ¶meter = 1 %then %goto endit;
<code you don't want to run>
%endit: %mend control; /* NOTE the full colon is used for the target label*/
%if ¶meter = 1 %then %do;
%put NOTE: Program terminated because parameter ¶meter was 1;
to provide a graceful message in the log about the termination.