Hello Forum - I need to trap any potential libname errors that occur inside a macro, and make them available to the remainder of my SAS program (so that I can output results of connectivity test.). Below is my code. How can I modify it to accomplish this? I have seen this post, but it did not help: https://communities.sas.com/t5/SAS-Procedures/LIBNAME-error-trapping/m-p/238132. Please, and Thank you in advance. %MACRO test_connection();
%DO I = 1 %TO &IDS;
%IF "&&type&I." EQ "DB2" /* success*/
%THEN
%DO;
LIBNAME DB2TST DB2 DATAsrc="&&datasrc&i." USER="&&user&i." PASSWORD="&&pwd&i." SCHEMA="&&schema&i." access=readonly;
/* Trap error here.
What code can trap an error, if it occurs, and make it available to the rest of the SAS program? */
%END;
%END;
%RUN;
%MEND test_connection;
%test_connection();
... View more