<?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: Searching for a file with partial name in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Searching-for-a-file-with-partial-name/m-p/686480#M208324</link>
    <description>&lt;P&gt;Do you have already a libref to "/users/abc" ?&lt;/P&gt;
&lt;P&gt;Suppose you don't have then:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname mydata "/users/abc";

%let flag = "N";
data _null_;
   set sashelp.table;
        if libnmae = 'MYDATA' and
          lowcase(substr,memname,1,7) = 'file_jan'  /* or feb or ... */
         then do;
                 if memname = "&amp;lt;full data set name&amp;gt;" /* omit .sas7bdat */
                    then call symput('flag', "Y");
         end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 24 Sep 2020 19:16:51 GMT</pubDate>
    <dc:creator>Shmuel</dc:creator>
    <dc:date>2020-09-24T19:16:51Z</dc:date>
    <item>
      <title>Searching for a file with partial name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Searching-for-a-file-with-partial-name/m-p/686471#M208320</link>
      <description>&lt;P&gt;Hello mentors,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm in a situation where I need to check the existence of a file in sas grid. The filename however has a date, which can be any date of the month, so there is no way to predict the full file name. For eg. in january, filename could be 'file_jan20_02jan20.sas7bdat', but in feb it could be 'file_feb20_08feb20.sas7bdat'. so there is absolutely no way to predict the right filename and look for it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I usually use the following code to check the existence of the file, and I searched around but couldn't find a way to look for partial names such that if file:&amp;nbsp;file_%SYSFUNC(TODAY(),monyy7.)_*.sas7bdat. Trying to do something along these lines using a wildcard.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
rc=fileexist("/users/abc/filename.sas7bdat");                                                                                                                                   
if rc &amp;gt; 0 then call symput ('flag',"Y");
else call symput ('flag',"N");
run;
%put &amp;amp;=flag;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate your guidance so very much!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 18:44:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Searching-for-a-file-with-partial-name/m-p/686471#M208320</guid>
      <dc:creator>AJ_Brien</dc:creator>
      <dc:date>2020-09-24T18:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: Searching for a file with partial name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Searching-for-a-file-with-partial-name/m-p/686480#M208324</link>
      <description>&lt;P&gt;Do you have already a libref to "/users/abc" ?&lt;/P&gt;
&lt;P&gt;Suppose you don't have then:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname mydata "/users/abc";

%let flag = "N";
data _null_;
   set sashelp.table;
        if libnmae = 'MYDATA' and
          lowcase(substr,memname,1,7) = 'file_jan'  /* or feb or ... */
         then do;
                 if memname = "&amp;lt;full data set name&amp;gt;" /* omit .sas7bdat */
                    then call symput('flag', "Y");
         end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 24 Sep 2020 19:16:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Searching-for-a-file-with-partial-name/m-p/686480#M208324</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-09-24T19:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: Searching for a file with partial name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Searching-for-a-file-with-partial-name/m-p/686502#M208338</link>
      <description>&lt;P&gt;That totally makes sense, thank you for the direction!&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 20:05:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Searching-for-a-file-with-partial-name/m-p/686502#M208338</guid>
      <dc:creator>AJ_Brien</dc:creator>
      <dc:date>2020-09-24T20:05:26Z</dc:date>
    </item>
  </channel>
</rss>

