DATA Step, Macro, Functions and more

SAS Macro for Importing All Tables from an Access Database

Reply
Occasional Contributor
Posts: 14

SAS Macro for Importing All Tables from an Access Database

I know that there is a discussion on this topic (, but I can't seem to be able to figure out the final product.  Does anyone have a documented process for accomplishing this task? I tried the following without any luck:

libname TAP2015 'C:\Users\V\Desktop\TAPDB_For SCRR\TAP Jan 2015';

%let dbname = C:\Users\V\Desktop\TAPDB_For SCRR\TAP Data Bi-annual end dec 31 2014\TAPData_1_12_2015.mdb;

%let tablelist = ABCProgramType

ActionItemDisposition

ActionPlan

ActionPlanType

Activity   

AgeGroup

ApAssessmentTool 

ApProgramSize;

%let filename = ABCProgramType;

proc import out = TAP2015.&filename

datatable = "&filename"

dbms = access replace;

database = "&dbname";

run;

Thank you for your time.

Super User
Posts: 10,501

Re: SAS Macro for Importing All Tables from an Access Database

Without any luck

If there were errors it would help to post them.

If the results were not as expected describe the unexpected results such as not all tables imported, only one, variables not of expected type or some detail.

Occasional Contributor
Posts: 14

Re: SAS Macro for Importing All Tables from an Access Database

I received the following error message:

ERROR: Unable to open file C:\Users\V\Desktop\TAPDB_For SCRR\TAP Data Bi-annual end dec 31 2014\TAPData_1_12_2015.mdb. It does not 

      exist or it is already opened exclusively by another user, or you need permission to view its data.

Super User
Posts: 10,501

Re: SAS Macro for Importing All Tables from an Access Database

If you have opened the database then MS Access locked it and you can't use this method.

Or double check the exact name and path, once in awhile a not-obvious space creeps into a path:

TAPDB_For SCRR or

TABDB_For  SCRR   <= 2 spaces

Ask a Question
Discussion stats
  • 3 replies
  • 225 views
  • 0 likes
  • 2 in conversation