Chapter Contents |
Previous |
Next |
LIBNAME |
Category: | SAS Table |
Syntax | |
Details | |
Examples | |
Example 1: Assigning a Libref | |
Example 2: Deassigning a Libref | |
Example 3: Using a List to Assign a Libref to Multiple SAS Data Libraries | |
See Also |
Syntax |
sysrc=LIBNAME(libref<,SAS-data-library<,engine <,options>>>); |
0 | The operation was successful. |
>0 | The operation was not successful. |
<0 | The operation was completed, but a warning or a note was generated. |
Type: Numeric
Type: Character
Type: Character
Type: Character
Type: Character
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 the SAS data library TEST.DATA. If an error or warning occurs, display the message on the message line.
if (libname('new','test.data'))then _msg_=sysmsg();
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 |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.