Hi,
I have a code with some macros where each of them extract a different data, and be like:
%extract_basex();
%extract_basey();
%extract_basez();
But, sometimes one of my macros get an error and the code stops. What could I do to for if one macro get an error the code goes to the next one?
For example, I want this:
%extract_basex(); --> Execute
%extract_basey(); --> Abend, the code stop this macro and goes to next
%extract_basez(); --> Execute
You can get more control by making your macro smart enough to detect the issues before they generate SAS errors and then skipping to the end of the macro. Something like:
%macro extract_basex();
%let anyerr=0;
%if not exist(&input_ds) %then %do;
%put ERROR: &=sysmacroname error. &=input_ds does not exist.;
%let anyerr=1;
%end;
%if anyerr %then %goto quit;
/* code that uses &input_ds */
...
%quit:
/* Code that cleans up whether or not any errors */
%mend extract_basex;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: