<?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 dataset name pattern and the EXIST function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/dataset-name-pattern-and-the-EXIST-function/m-p/310169#M66857</link>
    <description>&lt;P&gt;SAS Folks-&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does anyone know a shortcut for dataset names with the same pattern in the EXIST function?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to clear all datasets in the WORK library with the filename pattern MASTER before I start a macro to read external files, and I use : to get them all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;     proc datasets library=WORK ;
       delete MASTER: ;
       run ;
       quit ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, if there are no existing MASTER: datasets, it generates a note.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;NOTE: The file WORK.MASTER: (memtype=DATA) was not found, but appears on a DELETE statement.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just for neatness, I would like to test to here are no existing MASTER: datasets before I do the deletion, maybe something along this line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro DEL_MASTER(NAME);
    %if %sysfunc(exist(&amp;amp;name)) %then %do ;
         proc datasets library=WORK ;
           delete MASTER: ;
           run ;
           quit ;
    %end ;
%mend ;

%DEL_MASTER(MASTER_somedataset);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The only drawback is that it&amp;nbsp;requires that I know at least one of the MASTER dataset names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I use MASTER datasets in varying forms quite frequently when reading external data, and would love to be able to set up a macro to do this deletion without having to know any of the actual MASTER filenames.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%DEL_MASTER(MASTER:);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;does not work. Does anyone know a shortcut that does?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If not, I could&amp;nbsp;use the alternative of SASHELP.VMEMBER on LIBNAME and MEMNAME.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We are running&amp;nbsp;9.4 (TS1M3)&amp;nbsp; on a 64-bit Windows 7 virtual server by&amp;nbsp;remote login.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Wendy T&lt;/P&gt;</description>
    <pubDate>Tue, 08 Nov 2016 17:09:17 GMT</pubDate>
    <dc:creator>WendyT</dc:creator>
    <dc:date>2016-11-08T17:09:17Z</dc:date>
    <item>
      <title>dataset name pattern and the EXIST function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dataset-name-pattern-and-the-EXIST-function/m-p/310169#M66857</link>
      <description>&lt;P&gt;SAS Folks-&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does anyone know a shortcut for dataset names with the same pattern in the EXIST function?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to clear all datasets in the WORK library with the filename pattern MASTER before I start a macro to read external files, and I use : to get them all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;     proc datasets library=WORK ;
       delete MASTER: ;
       run ;
       quit ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, if there are no existing MASTER: datasets, it generates a note.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;NOTE: The file WORK.MASTER: (memtype=DATA) was not found, but appears on a DELETE statement.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just for neatness, I would like to test to here are no existing MASTER: datasets before I do the deletion, maybe something along this line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro DEL_MASTER(NAME);
    %if %sysfunc(exist(&amp;amp;name)) %then %do ;
         proc datasets library=WORK ;
           delete MASTER: ;
           run ;
           quit ;
    %end ;
%mend ;

%DEL_MASTER(MASTER_somedataset);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The only drawback is that it&amp;nbsp;requires that I know at least one of the MASTER dataset names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I use MASTER datasets in varying forms quite frequently when reading external data, and would love to be able to set up a macro to do this deletion without having to know any of the actual MASTER filenames.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%DEL_MASTER(MASTER:);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;does not work. Does anyone know a shortcut that does?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If not, I could&amp;nbsp;use the alternative of SASHELP.VMEMBER on LIBNAME and MEMNAME.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We are running&amp;nbsp;9.4 (TS1M3)&amp;nbsp; on a 64-bit Windows 7 virtual server by&amp;nbsp;remote login.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Wendy T&lt;/P&gt;</description>
      <pubDate>Tue, 08 Nov 2016 17:09:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dataset-name-pattern-and-the-EXIST-function/m-p/310169#M66857</guid>
      <dc:creator>WendyT</dc:creator>
      <dc:date>2016-11-08T17:09:17Z</dc:date>
    </item>
    <item>
      <title>Re: dataset name pattern and the EXIST function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dataset-name-pattern-and-the-EXIST-function/m-p/310177#M66864</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data _null_;
  set sashelp.vtable (where=(libname="WORK" and index(memname,"MASTER") &amp;gt; 0));
  if _n_=1 then call execute('proc datasets library=WORK; delete MASTER:; run; quit;');
run;&lt;/PRE&gt;
&lt;P&gt;Only if a dataset master exists in work then the proc datasets code will get generated. &amp;nbsp;TBH though, is it a good idea to have master datasets in a tempoprary area? &amp;nbsp;Having to remove datasets - especially in macros - seems to me to show the process is not very good. &amp;nbsp;Why do you need to delete them? &amp;nbsp;Why does the import of new data not overwite? &amp;nbsp;What is your import process? &amp;nbsp;I would suggest a sound import process would principally be responsible for importing data to a fixed area and validating it. &amp;nbsp;Any other process can then just assume the data is there and ready.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Nov 2016 17:17:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dataset-name-pattern-and-the-EXIST-function/m-p/310177#M66864</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-11-08T17:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: dataset name pattern and the EXIST function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dataset-name-pattern-and-the-EXIST-function/m-p/310191#M66870</link>
      <description>&lt;P&gt;RW9-&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the call execute method - that didn't even cross my mind.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just FYI...&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The typical scenario&amp;nbsp;I use for&amp;nbsp;WORK.MASTER: is&amp;nbsp;to put together&amp;nbsp;a bunch of files into a SAS dataset (usually&amp;nbsp;badly formatted Excel files).&amp;nbsp; The name came from a project that I did with a colleague, and when the process changed, the name did not (my bad).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once I&amp;nbsp;have&amp;nbsp;MASTER, then I&amp;nbsp;proceed with whatever needs to be done, and save the dataset to a permanent library. At that point, the MASTER: dataset(s) can be deleted to keep everything tidy.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also like to run the delete of MASTER before starting, just to make sure there aren't any leftovers from a previous process.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks so much for your help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Wendy T&lt;/P&gt;</description>
      <pubDate>Tue, 08 Nov 2016 18:09:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dataset-name-pattern-and-the-EXIST-function/m-p/310191#M66870</guid>
      <dc:creator>WendyT</dc:creator>
      <dc:date>2016-11-08T18:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: dataset name pattern and the EXIST function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dataset-name-pattern-and-the-EXIST-function/m-p/310210#M66880</link>
      <description>&lt;P&gt;Why not&amp;nbsp;use the NOWARN proc datasets statement option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc datasets nowarn&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Nov 2016 19:28:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dataset-name-pattern-and-the-EXIST-function/m-p/310210#M66880</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-11-08T19:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: dataset name pattern and the EXIST function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dataset-name-pattern-and-the-EXIST-function/m-p/310253#M66896</link>
      <description>&lt;P&gt;Data _null_-&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I thought about NOWARN, but&amp;nbsp;I&amp;nbsp;didn't want to turn off&amp;nbsp;warnings in case&amp;nbsp;there was another issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks so much!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Wendy&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Nov 2016 23:08:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dataset-name-pattern-and-the-EXIST-function/m-p/310253#M66896</guid>
      <dc:creator>WendyT</dc:creator>
      <dc:date>2016-11-08T23:08:49Z</dc:date>
    </item>
  </channel>
</rss>

