Chapter Contents

Previous

Next
SAS/CONNECT User's Guide

LIBNAME Syntax

LIBNAME libref <'SAS-data-library'> SERVER=remote-session-id <ACCESS=READONLY> <OUTREP= format> <SLIBREF=server-libref> <engine-options>;

libref
is any valid SAS name that refers to the remote library to be accessed. The libref must be the first argument in the LIBNAME statement.

In a SAS program, after you specify a library name in the LIBNAME statement, you refer to the libref in the following form:

data;
   set libref.SAS-data-set;
run;

If you omit the physical name of the data library in your LIBNAME statement and you do not specify the SLIBREF= option, the libref that you specify is presumed to match a libref that you previously defined in your remote session. Information about the SLIBREF= option appears later in this chapter.

'SAS-data-library'
must be a valid physical name for the SAS data library that you want to access. The name must be enclosed in single or double quotes.

If you omit the physical name, you can access the library by the libref argument if it has already been defined to a remote session or by the SLIBREF= option. Information about the SLIBREF= option appears later in this chapter.

SERVER=remote-session-id
identifies the remote session to which you have previously signed on.

ACCESS=READONLY
controls a user's read access to a data library, in this case, through a SAS/SHARE server. If you specify this option, you are able to read but not update data in the library. Other users may have read/write access to the library while it is accessed through the server.

For more information about this option, see the LIBNAME statement in SAS Language Reference: Dictionary.

OUTREP=format
The OUTREP= option allows you to create new files in a foreign host format. This is useful when the readers of a file will be using a different CPU than the creator of the file.

A data set is always converted to the remote host's format before writing to disk or reading for a local host. Therefore, attempting to convert a data set on the remote host to another host's format could cause extra translations and slower performance. The data could also suffer a loss of precision because of the extra translations. For these reasons, the use of OUTREP= is not generally recommended.

The valid format values for the OUTREP= option in Version 7 and later versions are:

¹ Support for these values was introduced in Version 8.

SLIBREF=server-libref
specifies the libref that is used by the remote session to identify the SAS data library when no physical name is specified and the local session's libref is different from the remote session's libref.

engine options
The following options characterize the remote engine (either the default base SAS engine or an alternative engine) that you specify in the LIBNAME statement.

RENGINE=engine-name
specifies the engine to be used to process the SAS data library in the server's SAS execution. Specify this option only to override the SAS default for a library in the server's execution or to reduce search time while the server determines which engine to use to access a specific SAS library. Ordinarily, this option should not be specified because the remote session determines which engine to use to process the data library.

RMTVIEW=YES|NO
determines whether SAS data views are interpreted in the remote session or the local host SAS session. SAS data views include DATA step views, as well as views created by using the SQL procedure and the ACCESS procedure (in SAS/ACCESS software). The default is YES.

SAS data views are accessed through an engine just as other SAS data sets are. Where a data 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 Institute creates a product-specific engine for each SAS/ACCESS interface product, which the SAS/ACCESS views use for that interface.

The default value of this option (YES) causes views to be interpreted in the remote session's SAS session. When views are interpreted in the remote SAS session, the remote session may require large amounts of processor time and storage, but the amount of data transferred to the local host's SAS session may be reduced. Conversely, disallowing view processing by the remote session might increase the amount of data transferred between the remote session and the local host's SAS session but prevents the remote session from using more than minimal processing time.

If you set the value of this option to NO, SAS data views are interpreted in the local host SAS session.

ROPTIONS="option=value<option=value> ..."
specifies options to the remote engine that are used to process the SAS data library in the remote session. ROPTIONS may be specified for either the default engine or an alternative engine that is specified by using the RENGINE= option. One or more options in the form keyword=value may be specified. You can specify as many options as you need. Use a blank space to separate options. (See the documentation for the specific engine that you will be using for information about remote engine options.) If you use the default engine and you want to specify options by using the ROPTIONS= option, it is recommended that you also specify the RENGINE= option for clarity.

The LIBNAME statement also takes the arguments LIST and CLEAR. See SAS Language Reference: Dictionary for more information.


Examples

libname sqldslib 'sasxyz.viewlib.sasdata' server=mvshost;
The preceding statement associates the libref SQLDSLIB with the SAS data library SASXYZ.VIEWLIB.SASDATA. This library will be accessed through the server MVSHOST, which is running in a remote CONNECT SAS session.
libname applib slibref=servlib server=myhost;
The preceding statement associates the local host's libref APPLIB with the remote host's libref SERVLIB. This library is accessed through the remote host MYHOST.

A single-user server is initialized in the remote SAS environment when a LIBNAME statement that references a SAS data library in the remote environment is executed by the local SAS session. No action is needed in the remote environment to initialize the server. All actions are controlled from the local SAS session. To start the server,

  1. sign on to create the remote session.

  2. specify the remote session id in the SERVER= option in the LIBNAME statement.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.