Configure Stata 16 to work with Postgres WRDS Database on a Apple Silicon Mac

214 Views Asked by At

I am currently trying to run some Stata code related to the WRDS database for my Ph.D. It is a postgres database requiring some configuration via ODBC. While isql connection via Terminal works, the command odbc list in Stata returns the following error:

The ODBC file libodbc.dylib could not be found on this system. Setting the unix LD_LIBRARY_PATH environment variable may correct this error.

I mainly followed the tutorial on https://gist.github.com/JonathanWillitts/7b5a519bd40dd730b98ce1ad75e859e8, trying to adapt it to the Postgres requirements for the Database via homebrew and psqlodbc. I assume the error comes from the variable export via Terminal that I use:

export LD_LIBRARY_PATH=/opt/homebrew/lib/ && /Applications/Stata/StataSE.app/Contents/MacOS/StataSE &

1

There are 1 best solutions below

2
On

I have had success downloading WRDS data into R using the RPostgres package.

If you do not figure out how to download WRDS data directly into Stata, a possible workaround is to:

https://datascienceplus.com/exporting-data-from-r/

I am happy to share R code for obtaining WRDS data. Let me know if this interest you and I can share my R code here.