BookmarkSubscribeRSS Feed
ross47
Calcite | Level 5

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?

1 REPLY 1
ross47
Calcite | Level 5

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. 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 861 views
  • 0 likes
  • 1 in conversation