I'm trying to get a list of SAS datasets from a working directory other than the SAS install directory. This is the connect string that I use:
Provider=SAS.BaseSASProvider;Data Source=local;SAS Executable=C:\Program Files\SASHome\SASFoundation\9.4\sas.exe;SAS Parameters=-initstmt %sasodbc(local) -icon -nosplash;SAS Working Directory=D:\MySASDatasetFolder
The OpenSchema method of the ADODB Connection object only returns tables for datasets in the SAS Executable directory.
How can I return tables for datasets in the D:\MySASDatasetFolder directory?
I'm trying to get a list of SAS datasets from a working directory other than the SAS install directory. This is the connect string that I use:
Provider=SAS.BaseSASProvider;Data Source=local;SAS Executable=C:\Program Files\SASHome\SASFoundation\9.4\sas.exe;SAS Parameters=-initstmt %sasodbc(local) -icon -nosplash;SAS Working Directory=D:\MySASDatasetFolder
The OpenSchema method of the ADODB Connection object only returns tables for datasets in the SAS Executable directory:
_ConnectionPtr m_Conn;
m_Conn.CreateInstance(__uuidof(Connection));
_bstr_t connString(getConnectionString());
_bstr_t username(getUsername());
_bstr_t password(getPassword());
m_Conn->Open(connString, username, password, adModeUnknown);
_RecordsetPtr OSchema = m_Conn->OpenSchema(adSchemaTables);
How can I return tables for datasets in the D:\MySASDatasetFolder directory? I suspect that it is a problem with my connect string but can't locate suitable documentation for confirmation.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.