<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Libref function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Libref-function/m-p/73696#M15868</link>
    <description>I'm trying to check to see if a library has been assisgned and have copied this verbatim out of the documentation.  I'm using the SASHELP library for testing.  It doesn't seem to work.  I know I've done this before and can't see what exactly I'm doing wrong.  Does it not work in enterprise guide?&lt;BR /&gt;
&lt;BR /&gt;
%macro test (lib=SASHELP);&lt;BR /&gt;
  %if (%sysfunc(LIBREF(&amp;amp;lib))) %then&lt;BR /&gt;
  %put %sysfunc(sysmsg());&lt;BR /&gt;
%mend;&lt;BR /&gt;
%test;&lt;BR /&gt;
&lt;BR /&gt;
As a check(of my sanity), I check the libname definitions with the following SQL and it shows up.  Any thoughts?&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  create table one as select distinct libname&lt;BR /&gt;
  from dictionary.libnames;&lt;BR /&gt;
&lt;BR /&gt;
Here's the log&lt;BR /&gt;
&lt;BR /&gt;
19         %macro test (lib=SASHELP);&lt;BR /&gt;
20         %if (%sysfunc(LIBREF(&amp;amp;lib))) %then&lt;BR /&gt;
21           %put %sysfunc(sysmsg());&lt;BR /&gt;
22         %mend;&lt;BR /&gt;
23         %test;&lt;BR /&gt;
MLOGIC(TEST):  Beginning execution.&lt;BR /&gt;
MLOGIC(TEST):  Parameter LIB has value SASHELP&lt;BR /&gt;
SYMBOLGEN:  Macro variable LIB resolves to SASHELP&lt;BR /&gt;
MLOGIC(TEST):  %IF condition (%sysfunc(LIBREF(&amp;amp;lib))) is FALSE&lt;BR /&gt;
MLOGIC(TEST):  Ending execution.&lt;BR /&gt;
24         *%LET RC =   %sysfunc(libref(INTGRP)) ; %put &amp;amp;RC;&lt;BR /&gt;
SYMBOLGEN:  Macro variable RC resolves to 0&lt;BR /&gt;
&lt;BR /&gt;
and the sql output.......&lt;BR /&gt;
&lt;BR /&gt;
AGRGRP&lt;BR /&gt;
CHEGRP&lt;BR /&gt;
ENEGRP&lt;BR /&gt;
INDGRP&lt;BR /&gt;
INTGRP&lt;BR /&gt;
MAPS&lt;BR /&gt;
SASHELP&lt;BR /&gt;
SASUSER&lt;BR /&gt;
WORK&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
    <pubDate>Tue, 21 Sep 2010 19:09:17 GMT</pubDate>
    <dc:creator>LAP</dc:creator>
    <dc:date>2010-09-21T19:09:17Z</dc:date>
    <item>
      <title>Libref function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Libref-function/m-p/73696#M15868</link>
      <description>I'm trying to check to see if a library has been assisgned and have copied this verbatim out of the documentation.  I'm using the SASHELP library for testing.  It doesn't seem to work.  I know I've done this before and can't see what exactly I'm doing wrong.  Does it not work in enterprise guide?&lt;BR /&gt;
&lt;BR /&gt;
%macro test (lib=SASHELP);&lt;BR /&gt;
  %if (%sysfunc(LIBREF(&amp;amp;lib))) %then&lt;BR /&gt;
  %put %sysfunc(sysmsg());&lt;BR /&gt;
%mend;&lt;BR /&gt;
%test;&lt;BR /&gt;
&lt;BR /&gt;
As a check(of my sanity), I check the libname definitions with the following SQL and it shows up.  Any thoughts?&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  create table one as select distinct libname&lt;BR /&gt;
  from dictionary.libnames;&lt;BR /&gt;
&lt;BR /&gt;
Here's the log&lt;BR /&gt;
&lt;BR /&gt;
19         %macro test (lib=SASHELP);&lt;BR /&gt;
20         %if (%sysfunc(LIBREF(&amp;amp;lib))) %then&lt;BR /&gt;
21           %put %sysfunc(sysmsg());&lt;BR /&gt;
22         %mend;&lt;BR /&gt;
23         %test;&lt;BR /&gt;
MLOGIC(TEST):  Beginning execution.&lt;BR /&gt;
MLOGIC(TEST):  Parameter LIB has value SASHELP&lt;BR /&gt;
SYMBOLGEN:  Macro variable LIB resolves to SASHELP&lt;BR /&gt;
MLOGIC(TEST):  %IF condition (%sysfunc(LIBREF(&amp;amp;lib))) is FALSE&lt;BR /&gt;
MLOGIC(TEST):  Ending execution.&lt;BR /&gt;
24         *%LET RC =   %sysfunc(libref(INTGRP)) ; %put &amp;amp;RC;&lt;BR /&gt;
SYMBOLGEN:  Macro variable RC resolves to 0&lt;BR /&gt;
&lt;BR /&gt;
and the sql output.......&lt;BR /&gt;
&lt;BR /&gt;
AGRGRP&lt;BR /&gt;
CHEGRP&lt;BR /&gt;
ENEGRP&lt;BR /&gt;
INDGRP&lt;BR /&gt;
INTGRP&lt;BR /&gt;
MAPS&lt;BR /&gt;
SASHELP&lt;BR /&gt;
SASUSER&lt;BR /&gt;
WORK&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
      <pubDate>Tue, 21 Sep 2010 19:09:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Libref-function/m-p/73696#M15868</guid>
      <dc:creator>LAP</dc:creator>
      <dc:date>2010-09-21T19:09:17Z</dc:date>
    </item>
    <item>
      <title>Re: Libref function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Libref-function/m-p/73697#M15869</link>
      <description>proc sql; &lt;BR /&gt;
create view uxwrk.OldDataSets as&lt;BR /&gt;
select distinct memname as memname &lt;BR /&gt;
from dictionary.tables&lt;BR /&gt;
where upcase(libname)=SASHELP' and memtype='DATA'&lt;BR /&gt;
order by memname&lt;BR /&gt;
;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
proc sql noprint; /*Create macro var to be used in filtering out the crooks*/&lt;BR /&gt;
select memname into :ds1 - :ds45&lt;BR /&gt;
from OldDataSets;&lt;BR /&gt;
quit;&lt;BR /&gt;
%put &amp;amp;ds45;</description>
      <pubDate>Tue, 21 Sep 2010 19:32:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Libref-function/m-p/73697#M15869</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2010-09-21T19:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: Libref function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Libref-function/m-p/73698#M15870</link>
      <description>The libref function returns a zero (not a one) if a libref is found.  For example,  try the following:&lt;BR /&gt;
&lt;BR /&gt;
%macro test (lib=SASHELP);&lt;BR /&gt;
%if (%sysfunc(LIBREF(&amp;amp;lib))=0) %then %put Library Assigned;&lt;BR /&gt;
%mend;&lt;BR /&gt;
%test;&lt;BR /&gt;
&lt;BR /&gt;
I'm not sure what the existance of a library has to do with the sysmsg function.  The sysmsg function might return a missing value even if the library has been assigned.</description>
      <pubDate>Tue, 21 Sep 2010 19:47:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Libref-function/m-p/73698#M15870</guid>
      <dc:creator>polingjw</dc:creator>
      <dc:date>2010-09-21T19:47:59Z</dc:date>
    </item>
    <item>
      <title>Re: Libref function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Libref-function/m-p/73699#M15871</link>
      <description>Ahhh. Just the opposite of what I thought it should be  Thanks.</description>
      <pubDate>Tue, 21 Sep 2010 22:09:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Libref-function/m-p/73699#M15871</guid>
      <dc:creator>LAP</dc:creator>
      <dc:date>2010-09-21T22:09:53Z</dc:date>
    </item>
  </channel>
</rss>

