06-04-2012 09:09 AM
when I connect to SQL server with SAS ,I use the code as below.
Could anybody please help me explain what is the defference between sdn and schema?
libname mydatas odbc
06-04-2012 09:54 AM
seems like dsn(data source name) denotes database's name
schema specify a subfolder under this database(there would be many tables(datasets) under the schema specified folder, these tables(datasets) will be listed in under the libname folder of SAS )
06-04-2012 11:50 AM
That's a good way to think of it.
In SQL you refer to tables using a two level system schema.table_name and then variables with a three level system, schema.table_name.variable_name
SAS uses different notation so you need to specify your schema in the database connection to allow SAS to appropriately transfer the names.
I've seen the schema used to differentiate different programs that are stored/warehoused in the same db.
06-04-2012 04:55 PM
Thank you Sapper,
After the libname statement was finished,I found some of these tables in the SQL server didn't show up in the SAS folder. what cause this happen?
06-05-2012 01:23 AM
If the table names are longer than 32 characters one way they can be accessed is by using SQL Pass Through.
connect to odbc(dsn=name1);
create table x as
from connection to odbc(
disconnect from odbc;
06-04-2012 01:22 PM
Check the link out and it has database specific properties of the connection string. This should help you out!