Using the SCHEMA= Data Set Option to Reference a Subsequent Data Source in a Federated DSN

Details

SAS Federation Server supports DSN definitions that reference multiple data sources. The data sources can be on the same DBMS or from different DBMS. A DSN definition that references multiple data sources is referred to as a “federated DSN”.
The FEDSVR LIBNAME engine supports accessing one data source at a time. This example shows how to use the SCHEMA= data set option to access data with a DSN that references two Base SAS schemas.
Note: You must obtain appropriate schema names from the SAS Federation Server administrator in order to perform this procedure.

Program

libname f fedsvr server="d1234.us.company.com" port=2171
user="myid" password="mypwd" dsn=feddsn;1

proc datasets lib=f; run; quit;2

proc print data=f.ids; run;3 

proc print data=f.class2(SCHEMA=schema2); run;4

Program Description

  1. The LIBNAME statement assigns libref F to a DSN definition named FEDDSN, which defines access to two Base SAS schemas: SCHEMA1 and SCHEMA2. The default behavior of the engine is to reference the first data source that is defined in the DSN, which is SCHEMA1. The SCHEMA= data source processing option could be specified in the LIBNAME statement to reference SCHEMA2 instead.
  2. PROC DATASETS lists the tables that are available in SCHEMA1.
    PROC DATASETS Listing of SCHEMA1
    PROC DATASETS listing of SCHEMA1
  3. The first PROC PRINT request specifies to print table F.Ids from SCHEMA1. The schema that is indicated in the LIBNAME statement is the active schema, unless the SCHEMA= data set option is used.
  4. SCHEMA2 has a table in it named Class2. The second PROC PRINT specifies to print table F.Class2. The SCHEMA= data set option is used to change the focus of the FEDSVR engine from SCHEMA1 to SCHEMA2.