<?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: New timestamp on external file when sas program executes in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729847#M227197</link>
    <description>Then maybe move your control file to another folder and do not take into account "last modified date" for file deletion. Or create TODO_DONE list (data set) where you keep inventory of your files (FILENAME column) and STATUS column ("TODO" or "DONE" values) and/or DATE_DELETED column (. if to be deleted, and some real date when it was done). Just solve the problem instead of creating one.</description>
    <pubDate>Mon, 29 Mar 2021 17:28:19 GMT</pubDate>
    <dc:creator>LeonidBatkhan</dc:creator>
    <dc:date>2021-03-29T17:28:19Z</dc:date>
    <item>
      <title>New timestamp on external file when sas program executes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729464#M226996</link>
      <description>&lt;P&gt;Hi, I'd appreciate your input&lt;/P&gt;&lt;P&gt;My program takes an Excel file with control values as input.&lt;/P&gt;&lt;P&gt;I want to make sure the Excel file gets a new modified date when my program executes.&lt;/P&gt;&lt;P&gt;A SAS consultant suggested this approach:&lt;BR /&gt;x "cd ""&amp;amp;Indir.""";&lt;BR /&gt;filename copy pipe "copy /b ""&amp;amp;Infile."" +,,";&lt;BR /&gt;data _NULL_;&lt;BR /&gt;infile copy;&lt;BR /&gt;input;&lt;BR /&gt;put _INFILE_;&lt;BR /&gt;run;&lt;BR /&gt;filename copy clear;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I get the error message:&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;The system cannot find the file specified.&lt;BR /&gt;Stderr output:&lt;BR /&gt;'...Input directory...'&lt;BR /&gt;CMD.EXE was started with the above path as the current directory.&lt;BR /&gt;UNC paths are not supported. Defaulting to Windows directory.&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can this approach be made to work or do you have an alternative solution&lt;BR /&gt;&amp;nbsp;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 26 Mar 2021 19:04:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729464#M226996</guid>
      <dc:creator>PerBundgaard</dc:creator>
      <dc:date>2021-03-26T19:04:53Z</dc:date>
    </item>
    <item>
      <title>Re: New timestamp on external file when sas program executes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729482#M227006</link>
      <description>&lt;P&gt;You want to change the date on the input file?&amp;nbsp; But you don't want to actually generate a new file?&lt;/P&gt;
&lt;P&gt;What operating system is your SAS session running under?&amp;nbsp; Does it support the touch command?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let original_file=\\some_server\some_share\some_directory\some_file.xlsx;
data _null_;
  infile "touch &amp;amp;original_file" pipe ;
  input;
  put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Mar 2021 20:21:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729482#M227006</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-03-26T20:21:19Z</dc:date>
    </item>
    <item>
      <title>Re: New timestamp on external file when sas program executes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729485#M227008</link>
      <description>Yes, just right&lt;BR /&gt;I want to 'touch' file just enough for it to get a new modified date&lt;BR /&gt;I'm in a windows setting, not sure touch command is for windows, but I'll try it out&lt;BR /&gt;Thanks and best&lt;BR /&gt;</description>
      <pubDate>Fri, 26 Mar 2021 20:33:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729485#M227008</guid>
      <dc:creator>PerBundgaard</dc:creator>
      <dc:date>2021-03-26T20:33:41Z</dc:date>
    </item>
    <item>
      <title>Re: New timestamp on external file when sas program executes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729488#M227010</link>
      <description>&lt;P&gt;Hi &lt;A class="trigger-hovercard" style="color: #007dc3;" href="https://communities.sas.com/t5/user/viewprofilepage/user-id/17271" target="_blank" rel="noopener"&gt;PerBundgaardLarsen&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;You can "touch" your file using the following 2 commands:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x "cd ""&amp;amp;indir""";
x "copy /b ""&amp;amp;infile""+";
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Mar 2021 20:45:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729488#M227010</guid>
      <dc:creator>LeonidBatkhan</dc:creator>
      <dc:date>2021-03-26T20:45:31Z</dc:date>
    </item>
    <item>
      <title>Re: New timestamp on external file when sas program executes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729494#M227012</link>
      <description>Hmm, I afraid not, but thanks&lt;BR /&gt;</description>
      <pubDate>Fri, 26 Mar 2021 20:50:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729494#M227012</guid>
      <dc:creator>PerBundgaard</dc:creator>
      <dc:date>2021-03-26T20:50:37Z</dc:date>
    </item>
    <item>
      <title>Re: New timestamp on external file when sas program executes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729509#M227019</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/51532"&gt;@LeonidBatkhan&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi &lt;A class="trigger-hovercard" style="color: #007dc3;" href="https://communities.sas.com/t5/user/viewprofilepage/user-id/17271" target="_blank" rel="noopener"&gt;PerBundgaardLarsen&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;You can "touch" your file using the following 2 commands:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x "cd ""&amp;amp;indir""";
x "copy /b ""&amp;amp;infile""+";
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hope this helps.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You seemed to have missed the original question as that is the code they started with.&amp;nbsp; The problem with that code is the CD command because the shell does not let you CD to a UNC path, only something with a drive letter assigned. Fortunately the CD command is not needed.&amp;nbsp; Note if you use a data step to run the commands instead of the X command then you can capture the messages the operating system returns.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  infile "copy /b ""&amp;amp;indir\&amp;amp;infile""+" pipe;
  input;
  put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Mar 2021 23:31:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729509#M227019</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-03-26T23:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: New timestamp on external file when sas program executes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729512#M227021</link>
      <description>&lt;P&gt;I really appreciate the suggestions, but doesn't seem to be possible to "touch" an external file due to UNC or what am I missing ? Thanks&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;NOTE: The infile "copy /b&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;""\\UNC-path\Input.xlsx"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"+" is:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Unnamed Pipe Access Device,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;PROCESS=copy /b&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"\\UNC-pathInput.xlsx"+&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;RECFM=V,LRECL=32767&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;0 file(s) copied.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Stderr output:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;'\\UNC-path'&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;CMD.EXE was started with the above path as the current directory.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;UNC paths are not supported. Defaulting to Windows directory.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Access is denied.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;NOTE: 1 record was read from the infile "copy /b&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;""\\UNC-path\Input\Input.xlsx"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"+".&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;The minimum record length was 25.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;The maximum record length was 25.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;NOTE: DATA statement used (Total process time):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;real time 0.41 seconds&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;cpu time 0.06 seconds&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 27 Mar 2021 00:02:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729512#M227021</guid>
      <dc:creator>PerBundgaard</dc:creator>
      <dc:date>2021-03-27T00:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: New timestamp on external file when sas program executes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729515#M227022</link>
      <description>&lt;P&gt;Your earlier CD command has still messed up the default path.&lt;/P&gt;
&lt;P&gt;Try starting a new session and make sure not to run the CD commands.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS Remember to use the Insert Code button in the editor to get a pop-up for pasting your text so the forum doesn't try to format it.&lt;/P&gt;</description>
      <pubDate>Sat, 27 Mar 2021 00:20:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729515#M227022</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-03-27T00:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: New timestamp on external file when sas program executes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729535#M227038</link>
      <description>&lt;P&gt;Thanks for your advice on starting a new SAS session and for inserting code using the pop-up&lt;/P&gt;
&lt;P&gt;I've actually started a new SAS session with every attempt and this time restarted the PC&lt;/P&gt;
&lt;P&gt;I'm afraid I still have no luck, please refer inserted log. The difference seems to be that the cmd now starts in \\UNC-path2 where the program resides&lt;/P&gt;
&lt;P&gt;Please advice and best&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data _null_;
    infile "copy /b ""&amp;amp;indir\&amp;amp;infile""+" pipe;
    input;
    put _infile_;
run;

NOTE: The infile "copy /b
      ""\\UNC-path1\Input.xlsx"
      "+" is:
      Unnamed Pipe Access Device,

      PROCESS=copy /b
      "\\UNC-path1\Input.xlsx"+
      ,
      RECFM=V,LRECL=32767

        0 file(s) copied.
Stderr output:
'\\UNC-path2'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.
Access is denied.
NOTE: 1 record was read from the infile "copy /b
      ""\\UNC-path1\Input.xlsx"
      "+".
      The minimum record length was 25.
      The maximum record length was 25.
NOTE: DATA statement used (Total process time):
      real time           0.51 seconds
      cpu time            0.06 seconds
&lt;/PRE&gt;</description>
      <pubDate>Sat, 27 Mar 2021 06:33:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729535#M227038</guid>
      <dc:creator>PerBundgaard</dc:creator>
      <dc:date>2021-03-27T06:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: New timestamp on external file when sas program executes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729556#M227053</link>
      <description>&lt;P&gt;That is interesting.&lt;/P&gt;
&lt;P&gt;Here is a method to find your current working directory without using PIPE.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  length fileref $8 directory $256 ;
  rc=filename(fileref,'.');
 directory=pathname(fileref);
  rc=filename(fileref);
  put directory=;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also check what operating system your SAS session is running on and even what machine.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put &amp;amp;=SYSHOSTINFOLONG;
%put &amp;amp;=SYSHOSTNAME;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Try changing the current directory to someplace that does have a drive letter.&amp;nbsp; For example you might assume that the drive C: exists and use that.&lt;/P&gt;
&lt;P&gt;You might be able to include it in the same command during the pipe:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;infile "cd c:\ ; copy /b ""&amp;amp;indir\&amp;amp;infile""+" pipe;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But you might also need to run it separately.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x 'cd c:\';&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 27 Mar 2021 13:32:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729556#M227053</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-03-27T13:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: New timestamp on external file when sas program executes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729813#M227187</link>
      <description>&lt;P&gt;Hi &lt;A class="trigger-hovercard" style="color: #007dc3;" href="https://communities.sas.com/t5/user/viewprofilepage/user-id/17271" target="_blank"&gt;PerBundgaardLarsen&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;The bigger question to ask is why do you want to change a file's "modified date" when you do not modify the file, but only read it? I suspect you are &lt;A href="https://blogs.sas.com/content/sgf/2016/05/23/are-you-solving-the-wrong-problem/" target="_self"&gt;solving the wrong problem&lt;/A&gt;...&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 14:57:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729813#M227187</guid>
      <dc:creator>LeonidBatkhan</dc:creator>
      <dc:date>2021-03-29T14:57:17Z</dc:date>
    </item>
    <item>
      <title>Re: New timestamp on external file when sas program executes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729816#M227188</link>
      <description>&lt;P&gt;More likely an &lt;A href="https://xyproblem.info/" target="_self"&gt;XY problem&lt;/A&gt;&amp;nbsp;than a refrigerator problem.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 15:01:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729816#M227188</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-03-29T15:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: New timestamp on external file when sas program executes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729845#M227196</link>
      <description>&lt;P&gt;Thank you both Tom and Leonid&lt;/P&gt;
&lt;P&gt;I loved the articles about the ice machine and the x vs y spending time on (wrong) problem solving :).&lt;/P&gt;
&lt;P&gt;In this family we ended up recycling the ice machine due to the cord problem but more over since it was never really any good and consequently just sat there on the shelf. As for the x and y problem you're quite right too. This is just one of those times where you go down a hole thinking some smart guy must know a smart, slick solution to what you think is a problem without filling in on the whole story.&lt;/P&gt;
&lt;P&gt;The utility program we want must take an Excel file in an UNC path as input for what files to delete in some specified folders and characterized by their last modified date and file extension. The control file resides in the same UNC path and we don't want the control file to qualify for deletion. One obvious solution would be to import and export the control file, which would give it new last modified date. but I read about the Linux/UNIX 'touch' approach and thought there might be a similar or workaround solution in a windows environment.&lt;/P&gt;
&lt;P&gt;Thank you for your patience&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 17:14:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729845#M227196</guid>
      <dc:creator>PerBundgaard</dc:creator>
      <dc:date>2021-03-29T17:14:38Z</dc:date>
    </item>
    <item>
      <title>Re: New timestamp on external file when sas program executes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729847#M227197</link>
      <description>Then maybe move your control file to another folder and do not take into account "last modified date" for file deletion. Or create TODO_DONE list (data set) where you keep inventory of your files (FILENAME column) and STATUS column ("TODO" or "DONE" values) and/or DATE_DELETED column (. if to be deleted, and some real date when it was done). Just solve the problem instead of creating one.</description>
      <pubDate>Mon, 29 Mar 2021 17:28:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729847#M227197</guid>
      <dc:creator>LeonidBatkhan</dc:creator>
      <dc:date>2021-03-29T17:28:19Z</dc:date>
    </item>
    <item>
      <title>Re: New timestamp on external file when sas program executes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729864#M227205</link>
      <description>Quite right&lt;BR /&gt;</description>
      <pubDate>Mon, 29 Mar 2021 19:22:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729864#M227205</guid>
      <dc:creator>PerBundgaard</dc:creator>
      <dc:date>2021-03-29T19:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: New timestamp on external file when sas program executes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729865#M227206</link>
      <description>&lt;P&gt;So you have a program that takes as input a filename X which contains a directory name (or set of directory names) that deletes files from those directories?&amp;nbsp; So why not just make that program smart enough to NOT delete its input?&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 19:30:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-timestamp-on-external-file-when-sas-program-executes/m-p/729865#M227206</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-03-29T19:30:21Z</dc:date>
    </item>
  </channel>
</rss>

