SAS Office Analytics, SAS Add-In for Microsoft Office, and other integrations

closing my connection to an Access database within a batch SAS session

Reply
N/A
Posts: 0

closing my connection to an Access database within a batch SAS session

On a Windows XP_PRO platform, I have a batch SAS program (v9.1.3) using a libname statement to read 600+ Access databases. I use a macro to read a table in each database and append the selected records to a SAS dataset for further processing. I've noticed that occasionally no records are selected from the Access table, which creates an empty temporary SAS dataset. Somehow, when there are no records selected, it looks as though that last Access database is kept open, even though subsequent databases are read and processed by the macro. This SAS program begins by using x statements to use a WinZip utility to unzip the archive where the Access databases are stored and write the databases into a folder, and at the end of the SAS statements in my program I use the x statements again to delete the .mdb files and the folders. My problem is that because the last .mdb file that had 0 records selected for processing within my program is still considered to be in use, my x statement won't delete that file. I end up having to manually delete the .mdb file. Is there code that I can incorporate into my SAS program to close the .mdb file?
N/A
Posts: 0

Re: closing my connection to an Access database within a batch SAS session

I don't have an Access database I can test this with, and in any case there is no guarantee I will have the same problem. However, I would suggest that if you are creating references to files that you will then manipulate through the operating system, then you should release the SAS connection to them first.

Whether it is a library reference or a file reference, the key word Clear will release the handle and may overcome your problem. Otherwise you may be in danger of memory leak or other OS problems because you have unused handles open on your session.

Libname ACCESSLIB Clear;
Ask a Question
Discussion stats
  • 1 reply
  • 169 views
  • 0 likes
  • 1 in conversation