There is a lot of excitement around SAS Workbench this year. One topic that can impact a customer’s use is how to get data in and out of SAS Workbench. There is information regarding what external data sources are supported, but I found that connecting to ODBC based sources like Microsoft SQL Server, Azure Synapse, Amazon Redshift, or Postgres can be a little tricky.
The challenge is when the libname statement uses a DSN. The use of a DSN means that the user must reference an odbc.ini file that contains such configurations. An administrator typically maintains this file and there is not a central shared data location for all users, so for Workbench, each user must also manage his/her own odbc.ini file. Even a dsnless connection still requires an entry in the ODBC.ini file.
The workaround is to:
After completing the steps above a connection to an ODBC based external data source for data access. This method gives users more choices for data sources for their analytic work. Using SAS access technology not only gives access to external sources but can also increase performance and productivity by pushing work to be done inside the database. Implicit and Explicit SQL pass-through queries are good examples.
Great tip. I made also try this on my SAS 9 server where, as you say, the admins control the odbc.ini. I hadn't realized that as a user it is that easy to point to a personal odbc.ini instead.
Nice to know. It is also worth pointing out that for some database connections you can avoid DSNs entirely and define everything in your connection strings like so:
libname sqllegno sqlsvr noprompt='Driver=SQLServer_Legacy;Address=machine2.reg.company.com,1433;Database=users;
UID=myuser;PWD=mypass;' schema=myschema;
This works well for SQL Server in my experience.
@SASKiwi I think DSN-less connections to SQL server are straight forward from SAS running on a Windows server, but require more configuration from SAS running on linux (Workbench runs on linux). I never got it working from linux, as our admins wanted to retain control over odbc connections. But it's possible it could work from workbench. Here's a link to a thread with a working example of DSN-less from linux: https://communities.sas.com/t5/SAS-Data-Management/Example-of-DSN-less-SQL-Server-connection-from-Li...
@Quentin - Thanks for pointing out the differences. I work in a Windows-only world currently so I'm not so familiar with linux-based data connections. Interesting to see that some file configuration is still required there.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.