Tips:LIBREF function return value

From sasCommunity
Jump to: navigation, search

It may be somewhat surprising that the LIBREF function returns 0 when the libref is indeed assigned. The return value of 0, however, is to be understood as "OK", "verified", or "successful", not as "false."

FILEREF also returns 0 when the fileref is verified as being assigned, while both FEXIST and FILEEXIST return 1 if the file exists.

libname mylib "~/temp";
%put %sysfunc(libref(mylib)) -- 0 means assignment verified;
 
libname mylib;
%put %sysfunc(libref(mylib)) -- ^0 means not verified;
 
/* on log
0     -- 0 means assignment verified
70006 -- ^0 means not verified
*/

Submitted by Chang Y. Chung. Contact me at my Discussion Page.

LIBREF (9.2)FILEREF (9.2)