Bancova News and Announcements

How to directly read data from postgresql database?

 
 
Picture of John Zhang
How to directly read data from postgresql database?
by John Zhang - Monday, 5 October 2015, 3:52 PM
 

You need to have SAS/ACCESS Interface to ODBC installed.

You need to install a PostgreSQL ODBC driver by downloading it from here:

 http://www.postgresql.org/ftp/odbc/versions/msi/

Once you have a driver installed on your Windows machine (the same machine where SAS is located) you simply setup a DSN to where PostgreSQL is located:

Control Panel --> System and Security --> Administrative Tools --> Data Sources (ODBC)

Create a SYSTEM DSN, and select ADD

Select the PostgreSQL driver (ANSI) normally works well and then fill in the information.

Select the "TEST" button and if it works then you have a functioning DSN that you can use in SAS like this:

libname myconn odbc dsn=YourDSN user=PostgresUser password=PostPass schema=public;