<?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: checking for the existence of a dataset in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/checking-for-the-existence-of-a-dataset/m-p/23050#M5056</link>
    <description>EXIST function will test the existence of the dataset, but you will need some macro coding to conditionally bypass the execution of the datastep.&lt;BR /&gt;
&lt;BR /&gt;
Cheers from Portugal&lt;BR /&gt;
&lt;BR /&gt;
Daniel Santos @ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;</description>
    <pubDate>Mon, 30 Nov 2009 17:36:11 GMT</pubDate>
    <dc:creator>DanielSantos</dc:creator>
    <dc:date>2009-11-30T17:36:11Z</dc:date>
    <item>
      <title>checking for the existence of a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/checking-for-the-existence-of-a-dataset/m-p/23048#M5054</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I want to check if a dataset exists before I run a datastep that will try to use that dataset.  If the dataset does not exist then, I don't want to run my data step as it will cause errors and therefore I may not be able to run my code in an automated environment.&lt;BR /&gt;
&lt;BR /&gt;
Can anyone help?</description>
      <pubDate>Mon, 30 Nov 2009 14:35:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/checking-for-the-existence-of-a-dataset/m-p/23048#M5054</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-11-30T14:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: checking for the existence of a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/checking-for-the-existence-of-a-dataset/m-p/23049#M5055</link>
      <description>Try the EXIST() function.&lt;BR /&gt;
Or look into the dictionary tables for SQL or the sashelp.vxxxx views..</description>
      <pubDate>Mon, 30 Nov 2009 14:42:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/checking-for-the-existence-of-a-dataset/m-p/23049#M5055</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2009-11-30T14:42:19Z</dc:date>
    </item>
    <item>
      <title>Re: checking for the existence of a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/checking-for-the-existence-of-a-dataset/m-p/23050#M5056</link>
      <description>EXIST function will test the existence of the dataset, but you will need some macro coding to conditionally bypass the execution of the datastep.&lt;BR /&gt;
&lt;BR /&gt;
Cheers from Portugal&lt;BR /&gt;
&lt;BR /&gt;
Daniel Santos @ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;</description>
      <pubDate>Mon, 30 Nov 2009 17:36:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/checking-for-the-existence-of-a-dataset/m-p/23050#M5056</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2009-11-30T17:36:11Z</dc:date>
    </item>
    <item>
      <title>Re: checking for the existence of a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/checking-for-the-existence-of-a-dataset/m-p/23051#M5057</link>
      <description>Not necessarily, a conditional use of %INCLUDE with a temp file (or CALL EXECUTE) also works, without needing the SAS macro language.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Mon, 30 Nov 2009 18:51:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/checking-for-the-existence-of-a-dataset/m-p/23051#M5057</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-11-30T18:51:02Z</dc:date>
    </item>
    <item>
      <title>Re: checking for the existence of a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/checking-for-the-existence-of-a-dataset/m-p/23052#M5058</link>
      <description>Oh yes, call execute will do the trick (and a lot of other tricks actually, a powerful statement indeed) , but I prefer to avoid it, has the coding gets "messier" and more difficult to maintain.&lt;BR /&gt;
&lt;BR /&gt;
I understand the use of %INCLUDE, but I'm curious on how would you conditionally execute it without the use of macro coding.&lt;BR /&gt;
&lt;BR /&gt;
The only way that I think of, would be to always produce a temp file (and include it), with one of the two possible codes, being one empty (if the dataset does not exist) and the other with the desired code to manipulate the existing dataset.&lt;BR /&gt;
&lt;BR /&gt;
Again, I find the latest a little bit more complex than the macro coding, but then again, all valid solutions.&lt;BR /&gt;
&lt;BR /&gt;
Cheers from Portugal&lt;BR /&gt;
&lt;BR /&gt;
Daniel Santos @ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;</description>
      <pubDate>Thu, 03 Dec 2009 11:26:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/checking-for-the-existence-of-a-dataset/m-p/23052#M5058</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2009-12-03T11:26:58Z</dc:date>
    </item>
    <item>
      <title>Re: checking for the existence of a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/checking-for-the-existence-of-a-dataset/m-p/23053#M5059</link>
      <description>The temp file approach is one I use frequently - always execute %INCLUDE &lt;FILEREF&gt;;  but the contents of the temp file is conditional based on prior SAS code.&lt;BR /&gt;
&lt;BR /&gt;
And, also consider that when not using macro code, the SAS line numbers are assigned for reference.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;/FILEREF&gt;</description>
      <pubDate>Thu, 03 Dec 2009 12:38:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/checking-for-the-existence-of-a-dataset/m-p/23053#M5059</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-12-03T12:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: checking for the existence of a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/checking-for-the-existence-of-a-dataset/m-p/23054#M5060</link>
      <description>Thanks guys,&lt;BR /&gt;
&lt;BR /&gt;
I used:&lt;BR /&gt;
&lt;BR /&gt;
%macro check;&lt;BR /&gt;
&lt;BR /&gt;
%if %sysfunc(exist(dataset))=0 %then %do;&lt;BR /&gt;
&lt;BR /&gt;
 &amp;gt;&amp;gt; blah blah  &amp;lt;&amp;lt;&lt;BR /&gt;
&lt;BR /&gt;
%end;&lt;BR /&gt;
%mend;&lt;BR /&gt;
&lt;BR /&gt;
%check;</description>
      <pubDate>Thu, 03 Dec 2009 14:29:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/checking-for-the-existence-of-a-dataset/m-p/23054#M5060</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-12-03T14:29:08Z</dc:date>
    </item>
    <item>
      <title>Re: checking for the existence of a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/checking-for-the-existence-of-a-dataset/m-p/23055#M5061</link>
      <description>Straight from the SAS-hosted documentation - link below:&lt;BR /&gt;
&lt;BR /&gt;
SAS Language Reference: Dictionary, EXIST Function&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/62618/HTML/default/a000210903.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/62618/HTML/default/a000210903.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Thu, 03 Dec 2009 15:07:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/checking-for-the-existence-of-a-dataset/m-p/23055#M5061</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-12-03T15:07:33Z</dc:date>
    </item>
  </channel>
</rss>

