<?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: sas looking for a physical file in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/sas-looking-for-a-physical-file/m-p/70930#M20449</link>
    <description>Hi&lt;BR /&gt;
The excel workbook used in this example for windows is:"c:\SASUSER\test.xls".&lt;BR /&gt;
The workbook has a sheet named "sheet1" with 2 column headings (A1: myfiles, B1: exist).&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
/* read files in directory */&lt;BR /&gt;
filename myfiles pipe 'dir "c:\SASUSER\*.sas" /B/ON';&lt;BR /&gt;
data FilesInDir;&lt;BR /&gt;
  infile myfiles truncover;&lt;BR /&gt;
  input myfiles $50.;&lt;BR /&gt;
  put _infile_;&lt;BR /&gt;
run;&lt;BR /&gt;
filename myfiles clear;&lt;BR /&gt;
&lt;BR /&gt;
/* Update Excel column 'exist' if matching filenames */&lt;BR /&gt;
LIBNAME WrkBk EXCEL "c:\SASUSER\test.xls"  scan_text=no;&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  update wrkbk.'sheet1$'n as xlssheet  &lt;BR /&gt;
    set exist='e' &lt;BR /&gt;
    where upcase(strip(xlssheet.myfiles)) in (select upcase(strip(myfiles)) from FilesInDir)&lt;BR /&gt;
  ;&lt;BR /&gt;
  select * from wrkbk.'sheet1$'n as xlssheet ;&lt;BR /&gt;
quit;&lt;BR /&gt;
LIBNAME WrkBk  clear;</description>
    <pubDate>Sat, 12 Sep 2009 13:33:28 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2009-09-12T13:33:28Z</dc:date>
    <item>
      <title>sas looking for a physical file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/sas-looking-for-a-physical-file/m-p/70928#M20447</link>
      <description>I need to write a program in SAS that would look for a physical file in a folder and if it is available then look for the file name and look if it matches it with the file name in an excel sheet then write a value in excel sheet with a letter “e” .&lt;BR /&gt;
&lt;BR /&gt;
 &lt;BR /&gt;
&lt;BR /&gt;
How can I do it?</description>
      <pubDate>Fri, 11 Sep 2009 18:13:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/sas-looking-for-a-physical-file/m-p/70928#M20447</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-09-11T18:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: sas looking for a physical file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/sas-looking-for-a-physical-file/m-p/70929#M20448</link>
      <description>For the "physical file detection", you can use the FILEEXIST call function, either in a DATA step or using %SYSFUNC and coding a macro.  Then perform additional processing when you find the file.  &lt;BR /&gt;
&lt;BR /&gt;
Regarding the Excel question; suggest searching the SAS support  &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  website using either the site SEARCH facility or the Google advanced argument below:&lt;BR /&gt;
&lt;BR /&gt;
update excel worksheet site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Fri, 11 Sep 2009 20:11:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/sas-looking-for-a-physical-file/m-p/70929#M20448</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-09-11T20:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: sas looking for a physical file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/sas-looking-for-a-physical-file/m-p/70930#M20449</link>
      <description>Hi&lt;BR /&gt;
The excel workbook used in this example for windows is:"c:\SASUSER\test.xls".&lt;BR /&gt;
The workbook has a sheet named "sheet1" with 2 column headings (A1: myfiles, B1: exist).&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
/* read files in directory */&lt;BR /&gt;
filename myfiles pipe 'dir "c:\SASUSER\*.sas" /B/ON';&lt;BR /&gt;
data FilesInDir;&lt;BR /&gt;
  infile myfiles truncover;&lt;BR /&gt;
  input myfiles $50.;&lt;BR /&gt;
  put _infile_;&lt;BR /&gt;
run;&lt;BR /&gt;
filename myfiles clear;&lt;BR /&gt;
&lt;BR /&gt;
/* Update Excel column 'exist' if matching filenames */&lt;BR /&gt;
LIBNAME WrkBk EXCEL "c:\SASUSER\test.xls"  scan_text=no;&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  update wrkbk.'sheet1$'n as xlssheet  &lt;BR /&gt;
    set exist='e' &lt;BR /&gt;
    where upcase(strip(xlssheet.myfiles)) in (select upcase(strip(myfiles)) from FilesInDir)&lt;BR /&gt;
  ;&lt;BR /&gt;
  select * from wrkbk.'sheet1$'n as xlssheet ;&lt;BR /&gt;
quit;&lt;BR /&gt;
LIBNAME WrkBk  clear;</description>
      <pubDate>Sat, 12 Sep 2009 13:33:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/sas-looking-for-a-physical-file/m-p/70930#M20449</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2009-09-12T13:33:28Z</dc:date>
    </item>
  </channel>
</rss>

