BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Rixile106
Fluorite | Level 6
good day expects.am trying to link to an SQL Server  using SAS

I've got an example:

LIBNAME ADPT ODBC DSN='PSQLETSCDSAG01' SCHEMA=HMLN_MIS;
LIBNAME ADPT ODBC DSN='PSQLETSCDSAG01' SCHEMA=DBO;

ERROR: CLI error trying to establish connection: [DataDirect][ODBC lib] Data source name not found and no default driver specified

1 ACCEPTED SOLUTION

Accepted Solutions
Sajid01
Meteorite | Level 14

Looks like the connection to SQL server has not been set.
Your SAS administrator should be able to help.

View solution in original post

4 REPLIES 4
JosvanderVelden
SAS Super FREQ
Is SAS on the same server as SQL?
Where are the odbc schema's defined?
Ex. ODBC Data Sources 32-bit on the machine where SAS runs.


Best regards, Jos
Reeza
Super User

Did you set up a DSN connection on your server/computer?

 

https://documentation.sas.com/doc/en/bicdc/9.4/bidsag/p1t9q2knb9tq5ln101dkrdsa9ymf.htm

 

LIBNAME is the second step in this process.

SASKiwi
PROC Star

What OS does your SAS server run on? If you want to specify everything in the database connection string try something like this:

 

libname SQLSRVR odbc noprompt = "server=SQLServerName;DRIVER=SQL Server Native Client 11.0;Trusted Connection=yes" DATABASE = MyDatabase schema = dbo;

You will need to know the SQL Server server name, the ODBC driver name, the database and schema. Check with your SAS administrator who should know all the details. If you specify the DSN option then that has to be defined separately and how you do that depends on the SAS server OS.

Sajid01
Meteorite | Level 14

Looks like the connection to SQL server has not been set.
Your SAS administrator should be able to help.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1933 views
  • 1 like
  • 5 in conversation