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?

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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