<?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 write SAS code to search a file's location? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99128#M27879</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you asking to know the full path to a file that you can already find?&amp;nbsp; You could use the FILENAME option on INFILE or FILE statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;70&amp;nbsp;&amp;nbsp; data _null_;&lt;/P&gt;&lt;P&gt;71&amp;nbsp;&amp;nbsp;&amp;nbsp; length filename $200;&lt;/P&gt;&lt;P&gt;72&amp;nbsp;&amp;nbsp;&amp;nbsp; infile 'myfile.txt' filename=filename;&lt;/P&gt;&lt;P&gt;73&amp;nbsp;&amp;nbsp;&amp;nbsp; putlog filename=;&lt;/P&gt;&lt;P&gt;74&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: The infile 'myfile.txt' is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Filename=C:\Documents and Settings\XXXXX\myfile.txt,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RECFM=V,LRECL=256,File Size (bytes)=0,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Last Modified=20Aug2012:15:05:10,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Create Time=20Aug2012:15:05:10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename=C:\Documents and Settings\XXXXX\myfile.txt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 20 Aug 2012 19:07:34 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2012-08-20T19:07:34Z</dc:date>
    <item>
      <title>how to write SAS code to search a file's location?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99126#M27877</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to use SAS searchingenginer to search a file's physical location?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example I have a file named "abc.txt", it locates at c:\myfile .I want to know what is the physical location of the file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Given I only&amp;nbsp; know the file's name is "abc.txt" but I don't know where it is,...so how could I use searching enginer in SAS to get its location: "c:\temp"?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Aug 2012 18:59:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99126#M27877</guid>
      <dc:creator>Mike_Davis</dc:creator>
      <dc:date>2012-08-20T18:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: how to write SAS code to search a file's location?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99127#M27878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Would using a pipe to run a dir command (assuming you are on windose) suffice?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Aug 2012 19:07:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99127#M27878</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-08-20T19:07:09Z</dc:date>
    </item>
    <item>
      <title>Re: how to write SAS code to search a file's location?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99128#M27879</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you asking to know the full path to a file that you can already find?&amp;nbsp; You could use the FILENAME option on INFILE or FILE statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;70&amp;nbsp;&amp;nbsp; data _null_;&lt;/P&gt;&lt;P&gt;71&amp;nbsp;&amp;nbsp;&amp;nbsp; length filename $200;&lt;/P&gt;&lt;P&gt;72&amp;nbsp;&amp;nbsp;&amp;nbsp; infile 'myfile.txt' filename=filename;&lt;/P&gt;&lt;P&gt;73&amp;nbsp;&amp;nbsp;&amp;nbsp; putlog filename=;&lt;/P&gt;&lt;P&gt;74&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: The infile 'myfile.txt' is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Filename=C:\Documents and Settings\XXXXX\myfile.txt,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RECFM=V,LRECL=256,File Size (bytes)=0,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Last Modified=20Aug2012:15:05:10,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Create Time=20Aug2012:15:05:10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename=C:\Documents and Settings\XXXXX\myfile.txt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Aug 2012 19:07:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99128#M27879</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-08-20T19:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: how to write SAS code to search a file's location?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99129#M27880</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Art,&lt;/P&gt;&lt;P&gt;Yes I am using wondows&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Aug 2012 21:55:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99129#M27880</guid>
      <dc:creator>Mike_Davis</dc:creator>
      <dc:date>2012-08-20T21:55:49Z</dc:date>
    </item>
    <item>
      <title>Re: how to write SAS code to search a file's location?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99130#M27881</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tom,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code has problem to run,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;45 data _null;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;46 length filename $200;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;47 infile 'list.txt' filename=filename;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;48 putlog filename=;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;49 run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR: Physical file does not exist, H:\list.txt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Aug 2012 22:00:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99130#M27881</guid>
      <dc:creator>Mike_Davis</dc:creator>
      <dc:date>2012-08-20T22:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: how to write SAS code to search a file's location?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99131#M27882</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This error indicates to me that the file list.txt is not in the current directory (root of H:).&amp;nbsp; From the earlier posts it is still unclear to me that the OP knows the actual location of the file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Aug 2012 23:03:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99131#M27882</guid>
      <dc:creator>ArtC</dc:creator>
      <dc:date>2012-08-20T23:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: how to write SAS code to search a file's location?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99132#M27883</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mike,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename indata pipe "dir \abc.txt /b /s";&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat fil2read $255.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile indata truncover;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input fil2read &amp;amp;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Aug 2012 23:30:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99132#M27883</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-08-20T23:30:11Z</dc:date>
    </item>
    <item>
      <title>Re: how to write SAS code to search a file's location?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99133#M27884</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great answer. It is working perfectly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Aug 2012 02:11:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99133#M27884</guid>
      <dc:creator>Yanzheng</dc:creator>
      <dc:date>2012-08-22T02:11:34Z</dc:date>
    </item>
    <item>
      <title>Re: how to write SAS code to search a file's location?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99134#M27885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Thank you Art,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the dir command works well but end with:&amp;nbsp; "file not found"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Aug 2012 22:00:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99134#M27885</guid>
      <dc:creator>Mike_Davis</dc:creator>
      <dc:date>2012-08-22T22:00:41Z</dc:date>
    </item>
    <item>
      <title>Re: how to write SAS code to search a file's location?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99135#M27886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mike,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you trying to find a file within your computer's c: drive, another drive on your computer, or on a network?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Aug 2012 22:17:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99135#M27886</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-08-22T22:17:06Z</dc:date>
    </item>
    <item>
      <title>Re: how to write SAS code to search a file's location?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99136#M27887</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What happens if two files with the same name are stored in different locations, ie a new version and backed up one?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems one of those things that you should know where to look rather than search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Windows Search is really useful and you can search by extension, so if i see some one has created a dataset called hidden_data I can search for it using&lt;/P&gt;&lt;P&gt;hidden_data ext:sas and it will list SAS programs that have that dataset in the code. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Aug 2012 22:23:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99136#M27887</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-08-22T22:23:28Z</dc:date>
    </item>
    <item>
      <title>Re: how to write SAS code to search a file's location?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99137#M27888</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Fareeza,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code I suggested, which is basically using Window's search capabilities, will provide the full path to each file in the case of duplicate names.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Aug 2012 22:30:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99137#M27888</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-08-22T22:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: how to write SAS code to search a file's location?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99138#M27889</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mike:&lt;/P&gt;&lt;P&gt;Art' code work well. But you need a little bit change since everyone's computer config is different. if you file is sitting in d: driver, please add "x d:;". The code will be like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;x d:;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;filename indata pipe "dir \abc.txt /b /s";&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data want;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; informat fil2read $255.;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; infile indata truncover;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; input fil2read &amp;amp;;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Aug 2012 23:38:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99138#M27889</guid>
      <dc:creator>Yanzheng</dc:creator>
      <dc:date>2012-08-22T23:38:44Z</dc:date>
    </item>
    <item>
      <title>Re: how to write SAS code to search a file's location?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99139#M27890</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or chang it if your file is under D disk.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename indata pipe " dir d:\x.txt /s/b ";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Aug 2012 02:34:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99139#M27890</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-08-23T02:34:37Z</dc:date>
    </item>
    <item>
      <title>Re: how to write SAS code to search a file's location?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99140#M27891</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mike,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In a command window (start --&amp;gt; run --&amp;gt; cmd.exe), type "help dir" and carefully read the output.&amp;nbsp; Get your search working from Windows itself, then paste that code into Art's solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH,&lt;/P&gt;&lt;P&gt;Scott&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Aug 2012 11:16:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99140#M27891</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2012-08-23T11:16:45Z</dc:date>
    </item>
    <item>
      <title>Re: how to write SAS code to search a file's location?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99141#M27892</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear&lt;/P&gt;&lt;P&gt;You can have a look on this type of code, include it inside a macro program :&lt;/P&gt;&lt;P&gt;It test if the file exist and backup it .&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN lang="EN"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;%let file_src=&amp;amp;original_path./my_file.txt;&lt;BR /&gt;%let flag_csc_exist=NO;&lt;BR /&gt;data _null_;&lt;BR /&gt; fname="tempfile";&lt;BR /&gt; rc=filename(fname,"&amp;amp;file_src");&lt;BR /&gt; if rc = 0 and fexist(fname) then call symput ('flag_csc_exist','YES');&lt;BR /&gt; rc=filename(fname);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%if &amp;amp;flag_csc_exist eq YES %then %do;&lt;BR /&gt; %put I must move the file ;&lt;BR /&gt; %let file_src_ar=&amp;amp;original_path./archive/my_file.txt_%TRIM(%QSYSFUNC(DATE(), YYMMDDN8.));&lt;BR /&gt; filename src_file "&amp;amp;file_src";&lt;BR /&gt; filename tgt_file "&amp;amp;file_src_ar";&lt;BR /&gt; data _null_; &lt;BR /&gt;&amp;nbsp; infile src_file; &lt;BR /&gt;&amp;nbsp; file tgt_file; &lt;BR /&gt;&amp;nbsp; input; &lt;BR /&gt;&amp;nbsp; put _infile_; &lt;BR /&gt; run;&lt;BR /&gt; filename src_file clear;&lt;BR /&gt; filename tgt_file clear;&lt;BR /&gt;%end;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN lang="EN"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Aug 2012 13:28:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-write-SAS-code-to-search-a-file-s-location/m-p/99141#M27892</guid>
      <dc:creator>lacrefa</dc:creator>
      <dc:date>2012-08-23T13:28:37Z</dc:date>
    </item>
  </channel>
</rss>

