LIBGEN= LIBNAME Statement Option

Configures the SPD Server connection to generate additional domain connections.

Valid in: SPD Server LIBNAME Statement
Default: NO
Applies to: Use of DS2 and FEDSQL languages with SPD Server; referencing more than one domain in explicit SQL pass-through

Syntax

LIBGEN=YES | NO

Required Arguments

NO

connects to the server with a single domain connection.

YES

generates additional domain connections. These additional connections have two purposes:

  • enable access to SPD Server with the SAS DS2 procedure and the SAS FEDSQL procedure. The procedures enable you to submit SAS DS2 and SAS FedSQL language statements to SPD Server. This functionality is new with SPD Server 5.3.
  • enable you to perform SQL joins across different server domains.

Details

To use the DS2 and FEDSQL procedures with SPD Server, you must have the third maintenance release of SAS 9.4 or later in addition to SPD Server 5.3.
PROC DS2 and PROC FEDSQL cannot be used to create tables in domains that have the attribute BACKUP=YES set in their domain definition. Users of the DS2 and FedSQL languages will get the following error if they try to create a table in a BACKUP=YES domain:
ERROR: Creation of aligned tables in BACKUP=YES domains not supported
BACKUP=YES on a domain does not prevent table creation with PROC SQL and the DATA step.
An SQL explicit pass-through connection typically specifies a single server domain. The LIBGEN= LIBNAME option enables you to easily reference a second server domain within an explicit pass-through connection. In order to use LIBGEN=, you must first assign LIBNAME statements that point to both domains in your SAS session, specifying LIBGEN=YES in both statements. Then connect to one domain using explicit pass-through. In the EXECUTE statement, identify each domain by using its previously assigned libref.

Examples

Example 1: Using LIBGEN=YES With New Language Procedures

The following example uses LIBGEN=YES to enable use of PROC FEDSQL and PROC DS2 with SPD Server.
libname mylib sasspds 'mydomain' host='host.company.com' service=5400
    user='anonymous' libgen=yes;

proc fedsql;
  ...FedSQL language statements ...;
quit;

proc ds2;
  ...DS2 language statements ...;
run;
quit;

Example 2: Using LIBGEN= To Support More Than One Domain

The following example uses the LIBGEN=YES LIBNAME option to perform a join between tables in different domains without having to issue an extra EXECUTE connection statement.
/* assign a libref to the first domain */
libname path1 sasspds 'domain1'
  server=boxer.5400
  libgen=yes
  ip=YES
  user='anonymous' ;

/* assign a libref to the second domain */
libname path2 sasspds 'domain2'
  server=boxer.5400
  libgen=yes
  ip=YES
  user='anonymous' ;

/* create a table in each domain */
data path1.table1
  (keep=i table1)
path2.table2
  (keep=i table2) ;

table1 = 'table1' ;
table2 = 'table2' ;

do i = 1 to 10 ;
  output ;
  end ;
run ;

proc sql ;
/* make an explicit connection to the first domain */
connect to sasspds (
  dbq='Path1'
  server=boxer.5140
  user='anonymous') ;

/* Use the assigned librefs */
/* to identify the tables in */
/* the EXECUTE statement   */

execute
 (create table table4 as
  select *
  from
   path1.table1 a,
   path2.table2 b
  where a.i = b.i)
by sasspds ;

disconnect from sasspds ;

quit ;

See Also

SAS 9.4 DS2 Language: Reference, Sixth Edition
SAS 9.4 FedSQL Language: Reference, Fifth Edition
SAS 9.4 Procedures Guide: Sixth Edition
Last updated: February 8, 2017