When using SAS to develop high-performance queries against remote SQL databases, it is helpful to see the exact ODBC messages that SAS passes to the driver. Sometimes the implicit SQL poorly translates a query, which can be optimized. To see these message, enable the SAS trace like this:
options sastrace=',,,d' sastraceloc=saslog nostsuffix;
However, when closing the SAS process, there can be a pop-up dialog window with the title "SAS Message Log" with entries like this:
ODBC: COMMIT performed on connection #6. ODBC: COMMIT performed on connection #5. ODBC: COMMIT performed on connection #4. ODBC: COMMIT performed on connection #3. ODBC: COMMIT performed on connection #2. ODBC: COMMIT performed on connection #1. ODBC: COMMIT performed on connection #0.
When running SAS interactively, this is a minor nuisance. When running SAS in an automated batch, this can be a serious problem because the dialog will wait indefinitely for human interaction, so the sas.exe process will never terminate.
This isn't exactly a bug, but it can feel like it. Sadly, SAS provides no convenient options like these:
- Never show the SAS message pop-up dialog when the SAS editor has closed.
- Automatically close the pop-up dialog after 60 seconds of inactivity.
- Filter all traces with the text "ODBC commit."
The SAS developer has these options:
- Disable the SAS trace.
- Send the SAS trace to a file like this:
options sastrace=',,,d' sastraceloc=file 'c:\sastest\mytrace.log' nostsuffix;
- Manually close the SAS Message Log whenever it appears.
- Use my Python script to automatically close the "SAS Message Log" dialog whenever it appears.
Tested on SAS 9.4M5 and Python 3.7 on Windows 10 and Windows Server 2008.
No comments:
Post a Comment