LIBNAME
Statement
Associates a libref (a shortcut name) with a SAS
library that is located on the server for client access.
Syntax
LIBNAME libref <engine>
< 'SAS-library'> SERVER=server-ID <options>
<engine/operating
environment-options> ;
Required Arguments
- libref
-
specifies the name
of a library reference to a SAS library that is located on the server.
The libref that you specify is presumed to be the server libref for
an existing server library. As alternatives, you could use the SLIBREF=
option or the physical name of the data library.
The
libref that you specify must be a valid SAS name,
and it must be the first argument in the LIBNAME statement.
- engine
-
specifies the name
of a valid SAS engine for a client to access the server library. Usually,
you should not use this option because the client automatically determines
which engine to use for accessing a server. Specify this option only
to override the SAS default for a specific server, or to reduce the
time that is needed to determine which engine to use to access a specific
server.
For example, if the
server library is located on a server that is running SAS 9 or later,
you could specify the REMOTE engine. Specifying an explicit engine
might improve performance slightly.
For a list of valid
engines, see the SAS documentation for your operating environment.
For background information about engines, see
SAS Language Reference: Concepts.
The
engine argument is positional. If you use it,
it must follow the libref.
CAUTION:
Do not
confuse the engine argument with the RENGINE= option.
An engine is used by
a client to access a server. An RENGINE is used by the server to access
its SAS library.
- 'SAS-library'
-
specifies the physical
name for the SAS library on the server to access. If you specify
a server library either as the libref or as the value for the SLIBREF=
option, you must omit the physical name.
If you specify
'SAS-library', the name must be a valid physical
name, and it must be enclosed in single or double quotation marks.
For details about specifying a SAS library, see the documentation
that is appropriate to your operating environment.
- SERVER=server-ID
-
specifies the ID of
the server (where the SAS library is located) that you previously
signed on to. The
server-ID is the value of the
remote-session-ID that is specified in the
SIGNON statement . To specify a server name that contains more than eight characters,
you must store the name in a macro variable.
Optional Arguments
- ACCESS=READONLY
-
controls a client's
read access to a SAS library on the server. If you specify this option,
you can read but not update data in the library.
- SLIBREF=server-libref
-
specifies an existing
server libref that you want to reference from the client. Use this
option when you want to reference an existing server libref, but you
want to use a different name for that libref on the client. If you
specify the SLIBREF= option, you do not need to specify the physical
name for the SAS library on the server. SLIBREF= server-libref and 'SAS-library' are mutually exclusive.
Engine and Operating Environment Options
- RENGINE=engine-name
-
specifies the engine
for the server session to use to access the SAS library on the server.
Using this option is usually unnecessary because the server automatically
determines the engine to use for processing the data library. Specify
this option only to override the SAS default for a specific library,
or to reduce the time that is used by the server to determine the
engine to use.
CAUTION:
Do not
confuse the RENGINE= option with the engine argument.
An RENGINE is used
by the server to access its SAS library. An engine is used by a client
to access a server.
- ROPTIONS=“option=value<option=value> ...”
-
specifies remote options
and options that are specific to an operating environment and that
the client passes to the engine on the server that processes the SAS
library. ROPTIONS can be specified for either the default engine or
an alternative engine that is specified by using the RENGINE= option.
You can specify one or more options in the form option=value. Use a blank to separate the options.
You can use the ROPTIONS= option to pass any valid option for the
targeted engine. For information about the options that are supported
by a specific engine, see the documentation for the engine that you
use. For details about options that are specific to an operating environment,
see the documentation that is appropriate for the operating environment
used.
- RMTVIEW=YES|NO
-
determines whether
SAS views are interpreted in the server session or the client session.
SAS views include DATA step views, in addition to views that are
created by using the SQL procedure and the ACCESS procedure (in SAS/ACCESS
software).
SAS views, like SAS
data sets, are accessed through an engine. Where a SAS view is interpreted
determines where the view engine is loaded and used. DATA step views
use the SASDSV engine, and PROC SQL views use the SQLVIEW engine.
SAS creates a product-specific engine for each
SAS/ACCESS interface
product that the
SAS/ACCESS views use for that interface.
When SAS views are
interpreted in the server session, the server session might require
large amounts of processor time and storage. However, the amount of
data that is transferred to the client session might be reduced. Conversely,
preventing view processing in the server session might increase the
amount of data that is transferred between the server and the client,
but minimizes server processing time.
Setting RMTVIEW to
NO causes SAS views to be interpreted at the client.
Default:YES, which causes views to be interpreted in the server
session.
Examples
Example 1: Assigning and Defining a Libref to Access a Library on a Server
The following statement
associates the libref SQLDSLIB with the SAS library SASXYZ.VIEWLIB.SASDATA.
This library is accessed through the server MVSHOST, which is running
in a server session.
libname sqldslib 'sasxyz.viewlib.sasdata' server=mvshost;
Example 2: Associating a Client Libref with a Server Libref
The following statement associates
the client libref APPLIB with the server libref SERVLIB. This library
is accessed through the server MYHOST.
libname applib slibref=servlib server=myhost;
Example 3: Specifying a Server in the LIBNAME Statement
The following example shows a spawner invocation on
a computer named MYHOST.MY.NET.WORK. The -SERVICE option specifies
that the spawner listens for client connections on port 2323.
spawner -c tcp -service 2323
In the following example,
a client uses the TCP/IP access method to connect to a server session
by using a spawner. The name of the computer that the spawner runs
on and the number of the port that the spawner listens on are assigned
to the macro variable REMNAME.
Note: Use a space to separate the
computer name from the port number.
A client signs on to
the server at the specified port that is defined by REMNAME. The LIBNAME
statement establishes the libref SCORCARD to point to a library via
the server and port that are defined by REMNAME.
options comamid=tcp;
%let remname=myhost.my.net.work 2323; /* space between computer name and port number */
signon remname; and port number */
libname scorcard '.' server=remname;