Using the SCHEMA= Data Source Processing Option

Details

This example shows how to use the SCHEMA= data source processing option to reference the second schema in a DSN that references two BASE SAS schemas.

Program

libname g fedsvr server='1234.us.company.com' port=2171 
user="myid" pwd="mypwd" DSN=FEDDSN schema=schema2;1

proc datasets lib=g; run; quit;2

proc print data=g.class2;run;3

proc print data=g.ids(schema=schema2); run;4 

Program Description

  1. The LIBNAME statement assigns libref G to the DSN definition named FEDDSN, which defines access to two BASE SAS schemas: SCHEMA1 and SCHEMA2. The SCHEMA= data source processing option is specified in the LIBNAME statement to reference SCHEMA2.
  2. PROC DATASETS lists the tables that are available in SCHEMA2.
    PROC DATASETS listing of SCHEMA2
    PROC DATASETS listing of SCHEMA2
  3. The first PROC PRINT request specifies to print table G.CLASS2 from SCHEMA2. The schema indicated in the LIBNAME statement is the active schema.
  4. The second PROC PRINT specifies to print table G.IDS from SCHEMA1. The SCHEMA= data set option is used to change the focus of the FEDSVR engine from SCHEMA2 to SCHEMA1.