Hi,
Was recently granted access to tables in a MS SQL Server database. Selects on tables work fine, but when I use a libname in odbc datasrc='...'; statement and run a proc contents data=in._all_; I get nothing back.
What permissions does proc contents need that I wasn't given?
Thanks!
--Ben
They should know what to do, if you specify that the ODBC connection should include the specific schema you're looking for. (and, they should be able to figure out what schema you mean if they know what tables you're accessing, so long as those table names aren't used in mulitple schemas)
You might look at https://support.sas.com/techsup/technote/ts765.pdf for more information about schemas (about halfway down the doc). This also discusses the code KSharp included.
This is on a SAS server and the ODBC entry was pre-defined. So I don't know what the schema was, unfortunately, much less if it was set properly. I don't have access directly to the DB server. So that's why I had to phrase the question as I did.
--Ben
You can use the following to get schema. but firstly you could try schema=dbo , maybe could solve your problem. proc sql; connect to odbc(.) select * from connection to odbc(ODBC::SQLTables); quit;
Wow. Didn't even know what this did. That returned a large amount of information. Will have the DBA compare it to what we should have assigned to us for a Table schema. Thanks!
--Ben
You may have to talk to your SAS admin then who set up the ODBC connection, as I am fairly sure that's where the problem lies.
Thanks! Anything I should tell them to look for?
--Ben
They should know what to do, if you specify that the ODBC connection should include the specific schema you're looking for. (and, they should be able to figure out what schema you mean if they know what tables you're accessing, so long as those table names aren't used in mulitple schemas)
You might look at https://support.sas.com/techsup/technote/ts765.pdf for more information about schemas (about halfway down the doc). This also discusses the code KSharp included.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.