BookmarkSubscribeRSS Feed
4Walk
Calcite | Level 5

In SAS Enterprise Miner is it possible to import data from an MS-Access accdb file without having to write code with a SAS code node like importing XLSX file using "File Import" node?

3 REPLIES 3
ballardw
Super User

If you are licensed for the SAS/Access to PC files you can use

LIBNAME libref ACCESS PATH='C:\PCFData\Demo.accdb';

Then you should be able to read the tables in the data base similar to a SAS data set. Suppose that Access data base above has a table name customer. You would be able to print it with

 

Proc print data=libref.customer;
run;

Of course you can use any valid libref name you like. ACCESS in the libname statement tells SAS you are going to read an Access data base and the path needs to include the database name and the extension.

 

4Walk
Calcite | Level 5

Thanks for the quick response.  the LIBNAME code needs to go into SAS Code node, right?  I was wondering whether the tables can be read without code.

 

Also, I used the following code in a SAS Code node and it ran without any errors, but I don't see the library anywhere.  I browsed with Explorer and also tried to create a Data Source, but couldn't find the library "ACCLIB".

 

LIBNAME acclib ACCESS PATH='D:\Documents\MGT4270\Data\WestRoxbury.accdb';

 

From the log:

NOTE: Libref ACCLIB was successfully assigned as follows:
Engine: ACCESS
Physical Name: D:\Documents\MGT4270\Data\WestRoxbury.accdb

ballardw
Super User

I don't have access or experience with Enterprise Miner (assuming that is the interface you are using).

So I can't say why can't find the library. I would guess that Proc Contents would give you a listing of data sets in the library if everything is working correctly since your log shows that it was actually created. Perhaps that library needs to be available when EM starts?

 

You may have issues if the original tables or columns in the data base have names with spaces or exceed the length of SAS data set or variable names. The SAS options VALIDVARNAME and VALIDMEMNAME may need to be set to ANY to allow use of name literals with the contents of that library.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 950 views
  • 0 likes
  • 2 in conversation