SAS Component Language Dictionary |
Category: | SAS Table |
Syntax |
sysrc=LIBNAME(libref<,SAS-data-library<,engine <,options>>>); |
contains the return code for the operation:
0 | |
>0 | |
<0 |
The operation was completed, but a warning or a note was generated. |
is the physical name of the SAS data library to be associated with the libref. This name can be up to 32K characters long. Specify this name as required by the host operating system.
is the engine to use for accessing the SAS files in the data library. If you are specifying a SAS/SHARE server, the engine should be REMOTE.
are options that are used by the specified engine. Multiple options are delimited by blank spaces in the same quoted string. For information about engines and options, see the SAS documentation for your operating environment.
Details |
The LIBNAME function follows the rules for the LIBNAME statement in Base SAS software.
Operating Environment Information: Some operating systems allow a SAS-data-library value of ' ' (with a space) and some allow '.' to assign a libref to the current directory. The behavior of LIBNAME when a single space or a period is specified for SAS-data-library is host dependent. Under some operating systems, librefs can be assigned using system commands outside the SAS session.
Examples |
Assign the libref NEW to SAS-data-library. If an error or warning occurs, display the message on the message line.
if (libname('new','SAS-data-library')) then _msg_=sysmsg();
Assign the libref MYLIB to SAS-data-library, and the server name and user access rights.
rc=libname('mylib','SAS-data-library','remote', 'server=servername access=readonly');
Deassign the libref NEW. If an error or warning occurs, display the message on the message line.
if (libname('new')) then _msg_=sysmsg();
Assign the libref DEF to several PC files whose names are stored in an SCL list:
lid=makelist(); rc=insertc(lid,"(",-1); rc=insertc(lid,"'M:\SAS\MAPS'",-1); rc=insertc(lid,"'C:\CATALOGS\sasuser'",-1); rc=insertc(lid,")",-1); rc=libname('DEF',' ','','',lid);
Assign the libref DEF to several UNIX files whose names are stored in an SCL list:
v1="(/mylib/store/data/facilities'"; v2="'/mylib/store/data/hresorces'"; v3="'/mylib/store/data/supplies')"; lid = makelist (); rc =insertc(lid,v1,-1); rc =insertc(lid,v2,-1); rc =insertc(lid,v3,-1); RC =LIBNAME('DEF',' ',",",lid);
See Also |
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.