<?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 Re: how to check if a library has been created otherwise abort in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-check-if-a-library-has-been-created-otherwise-abort/m-p/771686#M39649</link>
    <description>&lt;P&gt;"Does not exist" as in it was supposed to exist before the macro or program runs and doesn't?&lt;/P&gt;
&lt;P&gt;Or it was supposed to made in the macro and fails (for some reason)?&lt;/P&gt;</description>
    <pubDate>Fri, 01 Oct 2021 20:14:23 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-10-01T20:14:23Z</dc:date>
    <item>
      <title>how to check if a library has been created otherwise abort</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-check-if-a-library-has-been-created-otherwise-abort/m-p/771672#M39645</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Suppose that my mainfunction call m1, m2 , m3, m4&lt;/P&gt;
&lt;P&gt;ex:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%macro mainfunc;
%m1;
%m2;
%m3;
%m4;
%m5;

%mend mainfunc;
%mainfunc;&lt;/PRE&gt;
&lt;P&gt;So imagine that in m3, for example, I need to make a libname statement and if the libname does not exist, how can I abort the %mainfunc;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Oct 2021 19:31:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-check-if-a-library-has-been-created-otherwise-abort/m-p/771672#M39645</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2021-10-01T19:31:11Z</dc:date>
    </item>
    <item>
      <title>Re: how to check if a library has been created otherwise abort</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-check-if-a-library-has-been-created-otherwise-abort/m-p/771674#M39647</link>
      <description>Is the library a directory or can it be a file?&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Tips-from-the-Community/SAS-Tip-Check-if-a-directory-exists/td-p/475988" target="_blank"&gt;https://communities.sas.com/t5/SAS-Tips-from-the-Community/SAS-Tip-Check-if-a-directory-exists/td-p/475988&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;You may want to manually add a flag to your macro calls so they only execute if the previous step executed successfully so either create a variable at the end of the process that it completed successfully or rely on SAS automatic macro variables which can vary depending on the process. Usually easier and cleaner to manage manually.</description>
      <pubDate>Fri, 01 Oct 2021 19:34:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-check-if-a-library-has-been-created-otherwise-abort/m-p/771674#M39647</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-10-01T19:34:58Z</dc:date>
    </item>
    <item>
      <title>Re: how to check if a library has been created otherwise abort</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-check-if-a-library-has-been-created-otherwise-abort/m-p/771686#M39649</link>
      <description>&lt;P&gt;"Does not exist" as in it was supposed to exist before the macro or program runs and doesn't?&lt;/P&gt;
&lt;P&gt;Or it was supposed to made in the macro and fails (for some reason)?&lt;/P&gt;</description>
      <pubDate>Fri, 01 Oct 2021 20:14:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-check-if-a-library-has-been-created-otherwise-abort/m-p/771686#M39649</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-10-01T20:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: how to check if a library has been created otherwise abort</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-check-if-a-library-has-been-created-otherwise-abort/m-p/771738#M39651</link>
      <description>&lt;P&gt;Check function LIBREF() .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Examples
This example verifies a libref. If an error or warning occurs, the message is written
to the log. Under some operating environments, the user can assign librefs by using
system commands outside the SAS session.
%if (%sysfunc(libref(sashelp))) %then
%put %sysfunc(sysmsg());
&lt;/PRE&gt;</description>
      <pubDate>Sat, 02 Oct 2021 07:17:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-check-if-a-library-has-been-created-otherwise-abort/m-p/771738#M39651</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-10-02T07:17:28Z</dc:date>
    </item>
    <item>
      <title>Re: how to check if a library has been created otherwise abort</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-check-if-a-library-has-been-created-otherwise-abort/m-p/771775#M39653</link>
      <description>&lt;P&gt;I have found a good example on the web:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%macro libexits(libref);
	%if %sysfunc(libref(&amp;amp;libref)) %then
	%do;
		%put "&amp;amp;libref. does not exist";		
		%abort ;
	%end; 
	%else 
	%do;
		
		%put "the path of &amp;amp;libref. is : %sysfunc(pathname(&amp;amp;libref.))";
		
	%end;
	%mend libexits;
	%libexits(test);
&lt;/PRE&gt;</description>
      <pubDate>Sat, 02 Oct 2021 20:45:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-check-if-a-library-has-been-created-otherwise-abort/m-p/771775#M39653</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2021-10-02T20:45:58Z</dc:date>
    </item>
  </channel>
</rss>

