13.07.2015 Views

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

402 Macro Variables <strong>for</strong> <strong>Relational</strong> <strong>Databases</strong> 4 Chapter 12You can use these variables anywhere while you are accessing DBMS data. Becauseonly one set of macro variables is provided, it is possible that, if tables from twodifferent DBMSs are accessed, it might not be clear from which DBMS the errormessage originated. To address this problem, the name of the DBMS is inserted at thebeginning of the SYSDBMSG macro variable message or value. The contents of theSYSDBMSG and SYSDBRC macro variables can be printed in the <strong>SAS</strong> log by using the%PUT macro. They are reset after each <strong>SAS</strong>/<strong>ACCESS</strong> LIBNAME statement, DATAstep, or procedure is executed. In the statement below, %SUPERQ masks specialcharacters such as &, %, and any unbalanced parentheses or quotation marks thatmight exist in the text stored in the SYSDBMSG macro.%put %superq(SYSDBMSG)These special characters can cause unpredictable results if you use this statement:%put &SYSDBMSGIt is more advantageous to use %SUPERQ.If you try to connect to Oracle and use the incorrect password, you receive themessages shown in this output.Output 12.1<strong>SAS</strong> Log <strong>for</strong> an Oracle Error2? libname mydblib oracle user=pierre pass=paris path="orav7";ERROR: Oracle error trying to establish connection. Oracle error isORA-01017: invalid username/password; logon deniedERROR: Error in the LIBNAME or FILENAME statement.3? %put %superq(sysdbmsg);Oracle: ORA-01017: invalid username/passsword; logon denied4? %put &sysdbrc;-10175?You can also use SYMGET to retrieve error messages:msg=symget("SYSDBMSG");For example:data_null_;msg=symget("SYSDBMSG");put msg;run;The SQL pass-through facility generates return codes and error messages that areavailable to you through these <strong>SAS</strong> macro variables:SQLXMSGcontains DBMS-specific error messages.SQLXRCcontains DBMS-specific error codes.You can use SQLXMSG and SQLXRC only through explicit pass-through with theSQL pass-through facility. See Return Codes“Return Codes” on page 426.You can print the contents of SQLXMSG and SQLXRC in the <strong>SAS</strong> log by using the%PUT macro. SQLXMSG is reset to a blank string, and SQLXRC is reset to 0 whenany SQL pass-through facility statement is executed.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!