As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.


Here are some tips for How to share your SAS knowledge with your professional network.


Difference between revisions of "Tips:LIBREF function return value"

From sasCommunity
Jump to: navigation, search
m (add valign)
(Scheduled April 25, 2011)
Line 23: Line 23:
 
[http://support.sas.com/documentation/cdl/en/lrdict/63026/HTML/default/viewer.htm#a000210907.htm FILEREF (9.2)]
 
[http://support.sas.com/documentation/cdl/en/lrdict/63026/HTML/default/viewer.htm#a000210907.htm FILEREF (9.2)]
 
<noinclude>
 
<noinclude>
[[Category:Tip Ready]]
+
[[Category:Tip in Use]]
 
[[Category:LIBREF Function]]
 
[[Category:LIBREF Function]]
 
[[Category:FILEREF Function]]
 
[[Category:FILEREF Function]]

Revision as of 19:16, 16 April 2011

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)