BookmarkSubscribeRSS Feed
OliveiraMiguelZ
Obsidian | Level 7

I am trying to use an Access (MS Access) table with a name larger than 32 characters long in a PROC SQL join statement but it look like impossible to do so.

 

Does anyone knows how deal with that?

 

I've tried link the table to another one but it still doesn't work for SAS doesn't recognise it as a table. Also tried to use CONNET TO DBMS ( ... ), wich is the answer I found in StackOverflow, but the problem stay still.

 

Remembering that I can't simply just rename the table because it's part of some proccesses that came from external parts that i don't have how to rename.

4 REPLIES 4
Reeza
Super User
The connect to DBMS() option - aka direct pass through is the correct option. Please show what you've tried in that regards and we can help you modify your code as needed.
OliveiraMiguelZ
Obsidian | Level 7

I am not that good with this kind of connection, I tried something like this:

 

PROC SQL;
    CONNECT TO OLEDB ("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=\\myfilepath.mdb;")
    SELECT * FROM CONNECTION TO OLEDB ( 
       SELECT * FROM MyRecordsetName
     );
QUIT; 

 

Tom
Super User Tom
Super User

@OliveiraMiguelZ wrote:

I am not that good with this kind of connection, I tried something like this:

 

PROC SQL;
    CONNECT TO OLEDB ("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=\\myfilepath.mdb;")
    SELECT * FROM CONNECTION TO OLEDB ( 
       SELECT * FROM MyRecordsetName
     );
QUIT; 

 


Looks good.  What happened?  Did you get an error message?

 

I think that dialect of SQL allows you to use square brackets around object names.

 SELECT * FROM [MyRecordsetName]
Reeza
Super User
PROC SQL;
    CONNECT TO OLEDB ("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=\\myfilepath.mdb;")
   create table smallerName as
 SELECT * FROM CONNECTION TO OLEDB ( 
       SELECT * FROM MyRecordsetName
     );
QUIT; 

Other than the CREATE TABLE that's missing it seems correct to me. Did it not work for you?

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1275 views
  • 2 likes
  • 3 in conversation