My SAS program below works for connecting an SQL database. I tried to convert it to Stata using -odbc- but I keep receiving SQL errors shown below. It seems to be a driver related issue, but the driver is installed and that is how the SAS code works. So, I am not sure why Stata cannot load the specified driver. Can somebody please help me figure how to make the Stata code below work for the connection. Again, SAS code below works.
The ODBC driver reported the following diagnostics
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
SQLSTATE=IM002
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
SQLSTATE=IM002
Code:
/* SAS code that works SQL Server: DATPOT Database: ABC Schema: DATTECH */ libname ABCD oledb provider = sqloledb init_string = "Provider = SQLNCLI11.1; Integrated Security = SSPI; Persist Security Info = True; Initial Catalog = ABC; Data Source = DATPOT" schema = DATTECH
Code:
// Stata code that gives error odbc load, exec("SELECT * FROM DATTECH.TableA") conn("Provider=SQLNCLI11.1; Integrated Security=SSPI; Persist Security Info=True; Initial Catalog=ABC; Data Source=DATPOT") clear
Comment