<?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: X commands, how do they work? in Administration and Deployment</title>
    <link>https://communities.sas.com/t5/Administration-and-Deployment/X-commands-how-do-they-work/m-p/270830#M5026</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;xwait has nothing to do with this and only valid on Windows OS &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/hostwin/67962/HTML/default/viewer.htm#n0xwt90ik8vxdrn13708w6n3nm4o.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/hostwin/67962/HTML/default/viewer.htm#n0xwt90ik8vxdrn13708w6n3nm4o.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don’t understand from your example why you think the STAT info of&amp;nbsp;`/tmp/testfile' is going to change after a sleep.&lt;/P&gt;
&lt;P&gt;If you provide the exact command line in the UNIX shell with output I will show you that SAS will do the same using X. &amp;nbsp;You first need to get your commands correct in UNIX.&lt;/P&gt;</description>
    <pubDate>Tue, 17 May 2016 00:47:32 GMT</pubDate>
    <dc:creator>angian</dc:creator>
    <dc:date>2016-05-17T00:47:32Z</dc:date>
    <item>
      <title>X commands, how do they work?</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/X-commands-how-do-they-work/m-p/270292#M5010</link>
      <description>&lt;P&gt;Hello, I'm new to SAS Administration and SAS in general. I'm teaching myself BASE SAS and I've learned recently that you can issue OS commands. However I've come across something strange that I can't find answers to. When I run the stat command(should mention I'm working within a linux environment), the time stamps are just plane wrong, compared to when I issue the command normally through the bash prompt.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, I touch a file with an x command, run the stat command and appened it to the new file, I'll then sleep for a while and the run another stat command and then append it to the file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Both time stamps are equal to the time I execute the SAS script, where really I'd expect the second timestamp to be equal to the amount of time after the sleep command has been issued. Is this black magic?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure if it's relavent, but I'm running SAS 9.3.&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2016 09:07:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/X-commands-how-do-they-work/m-p/270292#M5010</guid>
      <dc:creator>daearol</dc:creator>
      <dc:date>2016-05-13T09:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: X commands, how do they work?</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/X-commands-how-do-they-work/m-p/270492#M5014</link>
      <description>&lt;PRE&gt;
try function  DATATIME() , NOT  system macro variable &amp;amp;sysdate &amp;amp;systime. 


%let timestamp=%sysfunc(datetime(),datetime.);

%put &amp;amp;timestamp;


&lt;/PRE&gt;</description>
      <pubDate>Sat, 14 May 2016 06:55:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/X-commands-how-do-they-work/m-p/270492#M5014</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-05-14T06:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: X commands, how do they work?</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/X-commands-how-do-they-work/m-p/270501#M5015</link>
      <description>&lt;P&gt;Post an example that replicates the problem.&lt;/P&gt;
&lt;P&gt;SAS is not changing your system clock, but perhaps you are looking at the wrong things.&lt;/P&gt;
&lt;P&gt;For example if you are trying to look at the status of the LOG file generated by a running SAS program you need to remember that SAS buffers its writes to the disk.&lt;/P&gt;</description>
      <pubDate>Sat, 14 May 2016 10:44:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/X-commands-how-do-they-work/m-p/270501#M5015</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-05-14T10:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: X commands, how do they work?</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/X-commands-how-do-they-work/m-p/270524#M5016</link>
      <description>Can you include your example program to illustrate the behavior you described?&lt;BR /&gt;</description>
      <pubDate>Sat, 14 May 2016 16:18:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/X-commands-how-do-they-work/m-p/270524#M5016</guid>
      <dc:creator>angian</dc:creator>
      <dc:date>2016-05-14T16:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: X commands, how do they work?</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/X-commands-how-do-they-work/m-p/270637#M5018</link>
      <description>&lt;P&gt;Hi sorry, it's this:&lt;/P&gt;&lt;P&gt;x "touch /tmp/testfile&lt;BR /&gt;x "stat &amp;gt;&amp;gt; /tmp/testfile&lt;BR /&gt;x "sleep 5"&lt;BR /&gt;x "stat &amp;gt;&amp;gt; /tmp/testfile"&lt;/P&gt;&lt;P&gt;1st output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Access: 2016-05-11 16:30:57.956598140 +0100&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Modify: 2016-05-11 16:30:57.956598140 +0100&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Change: 2016-05-11 16:30:57.956598140 +0100&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2nd output after the sleep:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Access: 2016-05-11 16:30:57.956598140 +0100&lt;BR /&gt;Modify: 2016-05-11 16:30:57.971598140 +0100&lt;BR /&gt;Change: 2016-05-11 16:30:57.971598140 +0100&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;gt;For example if you are trying to look at the status of the LOG file generated by a running SAS program you need to remember that SAS buffers its writes to the disk.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Okay but how does that make sense if you're pausing the script for an arbitrary amount of time? I've even tried sleeping using a SAS function, but all the x commands appear execute regardless.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry for the late reply.&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2016 08:06:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/X-commands-how-do-they-work/m-p/270637#M5018</guid>
      <dc:creator>daearol</dc:creator>
      <dc:date>2016-05-16T08:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: X commands, how do they work?</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/X-commands-how-do-they-work/m-p/270812#M5021</link>
      <description>First, I miss some end " and ; but that's probably typos in this post...?&lt;BR /&gt;&lt;BR /&gt;Second, what's the setting of XWAIT system option? &lt;BR /&gt;&lt;BR /&gt;Third, why are you doing this with SAS? You could easily put those commands in a shell script instead.</description>
      <pubDate>Mon, 16 May 2016 23:00:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/X-commands-how-do-they-work/m-p/270812#M5021</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-05-16T23:00:16Z</dc:date>
    </item>
    <item>
      <title>Re: X commands, how do they work?</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/X-commands-how-do-they-work/m-p/270815#M5023</link>
      <description>I'm doing this because I'm just learning how BASE SAS works, I'm fully&lt;BR /&gt;aware I could put this in a bash script. Secondly the team I look after use&lt;BR /&gt;x commands quite a lot in in their overnight SAS jobs.&lt;BR /&gt;&lt;BR /&gt;I'll take a look at the XWAIT system option. Thank you.&lt;BR /&gt;&lt;BR /&gt;##- Please type your reply above this line. Simple formatting, no&lt;BR /&gt;attachments. -##</description>
      <pubDate>Mon, 16 May 2016 23:09:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/X-commands-how-do-they-work/m-p/270815#M5023</guid>
      <dc:creator>daearol</dc:creator>
      <dc:date>2016-05-16T23:09:55Z</dc:date>
    </item>
    <item>
      <title>Re: X commands, how do they work?</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/X-commands-how-do-they-work/m-p/270819#M5025</link>
      <description>&lt;P&gt;I don't think you are using the STAT command properly. &amp;nbsp;What are you asking it to tell you the STAT of? &amp;nbsp;You seem to be missing the argument for this command.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I find it works much better to call your OS commands using an INFILE pipe instead of using X, SYSTEM() or %SYSEXEC().&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That way you can read the output and figure out if the operating system is trying the send you any messages.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let path=%sysfunc(pathname(work));

data _null_;
  input;
  cmd=resolve(_infile_);
  infile cmd pipe filevar=cmd end=eof;
  do while (not eof);
    input;
    put _infile_;
  end;
cards;
touch &amp;amp;path/testfile.txt
stat &amp;amp;path/testfile.txt
sleep 5
touch &amp;amp;path/testfile.txt
stat &amp;amp;path/testfile.txt
;;;;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2016 23:49:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/X-commands-how-do-they-work/m-p/270819#M5025</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-05-16T23:49:53Z</dc:date>
    </item>
    <item>
      <title>Re: X commands, how do they work?</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/X-commands-how-do-they-work/m-p/270830#M5026</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;xwait has nothing to do with this and only valid on Windows OS &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/hostwin/67962/HTML/default/viewer.htm#n0xwt90ik8vxdrn13708w6n3nm4o.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/hostwin/67962/HTML/default/viewer.htm#n0xwt90ik8vxdrn13708w6n3nm4o.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don’t understand from your example why you think the STAT info of&amp;nbsp;`/tmp/testfile' is going to change after a sleep.&lt;/P&gt;
&lt;P&gt;If you provide the exact command line in the UNIX shell with output I will show you that SAS will do the same using X. &amp;nbsp;You first need to get your commands correct in UNIX.&lt;/P&gt;</description>
      <pubDate>Tue, 17 May 2016 00:47:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/X-commands-how-do-they-work/m-p/270830#M5026</guid>
      <dc:creator>angian</dc:creator>
      <dc:date>2016-05-17T00:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: X commands, how do they work?</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/X-commands-how-do-they-work/m-p/270883#M5030</link>
      <description>Hi Tom, I was checking the modify time stamp. To see when the file was last&lt;BR /&gt;edited.&lt;BR /&gt;&lt;BR /&gt;I get the expected results in a bash script, of a 5 second difference&lt;BR /&gt;between the two time stamps. When I do this through SAS both time stamps&lt;BR /&gt;are equal to the time I execute the script.</description>
      <pubDate>Tue, 17 May 2016 06:34:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/X-commands-how-do-they-work/m-p/270883#M5030</guid>
      <dc:creator>daearol</dc:creator>
      <dc:date>2016-05-17T06:34:11Z</dc:date>
    </item>
    <item>
      <title>Re: X commands, how do they work?</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/X-commands-how-do-they-work/m-p/270886#M5031</link>
      <description>It's going to change after a sleep because I append the output of the stat&lt;BR /&gt;command after the sleep.&lt;BR /&gt;&lt;BR /&gt;x "stat &amp;gt;&amp;gt; /tmp/testfile";&lt;BR /&gt;&lt;BR /&gt;##- Please type your reply above this line. Simple formatting, no&lt;BR /&gt;attachments. -##</description>
      <pubDate>Tue, 17 May 2016 06:44:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/X-commands-how-do-they-work/m-p/270886#M5031</guid>
      <dc:creator>daearol</dc:creator>
      <dc:date>2016-05-17T06:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: X commands, how do they work?</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/X-commands-how-do-they-work/m-p/270891#M5032</link>
      <description>The stat will not reflect the 5 seconds gap because the I/O of the append happens after the stat command.&lt;BR /&gt;The fractionl difference you are seeing is the time for the first stat statement to write to standard out. &lt;BR /&gt;&lt;BR /&gt;I think to illustrate what you are trying to see is something like this&lt;BR /&gt;&lt;BR /&gt;x "touch /tmp/testfile";&lt;BR /&gt;x "stat /tmp/testfile &amp;gt;&amp;gt; /tmp/testfile";&lt;BR /&gt;x "sleep 5";&lt;BR /&gt;x "touch /tmp/testfile";&lt;BR /&gt;x "stat /tmp/testfile &amp;gt;&amp;gt; /tmp/testfile";&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;  File: `/tmp/testfile'&lt;BR /&gt;  Size: 0                 Blocks: 0          IO Block: 4096   regular empty file&lt;BR /&gt;Device: fd06h/64774d    Inode: 22          Links: 1&lt;BR /&gt;Access: (0644/-rw-r--r--)  Uid: (31898/  missas)   Gid: (  342/ mismeta)&lt;BR /&gt;Access: 2016-05-17 02:52:03.787098859 -0400&lt;BR /&gt;Modify: 2016-05-17 02:52:03.787098859 -0400&lt;BR /&gt;Change: 2016-05-17 02:52:03.787098859 -0400&lt;BR /&gt;  File: `/tmp/testfile'&lt;BR /&gt;  Size: 352             Blocks: 8          IO Block: 4096   regular file&lt;BR /&gt;Device: fd06h/64774d    Inode: 22          Links: 1&lt;BR /&gt;Access: (0644/-rw-r--r--)  Uid: (31898/  missas)   Gid: (  342/ mismeta)&lt;BR /&gt;Access: 2016-05-17 02:52:08.814236110 -0400&lt;BR /&gt;Modify: 2016-05-17 02:52:08.814236110 -0400&lt;BR /&gt;Change: 2016-05-17 02:52:08.814236110 -0400&lt;BR /&gt;</description>
      <pubDate>Tue, 17 May 2016 07:09:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/X-commands-how-do-they-work/m-p/270891#M5032</guid>
      <dc:creator>angian</dc:creator>
      <dc:date>2016-05-17T07:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: X commands, how do they work?</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/X-commands-how-do-they-work/m-p/270893#M5033</link>
      <description>&lt;P&gt;If I run this in a shell I get the same expected results and consistent with SAS&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;touch /tmp/testfile&lt;BR /&gt;stat /tmp/testfile &amp;gt;&amp;gt; /tmp/testfile&lt;BR /&gt;sleep 5s&lt;BR /&gt;stat /tmp/testfile &amp;gt;&amp;gt; /tmp/testfile&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;File: `/tmp/testfile'&lt;BR /&gt; Size: 0 Blocks: 0 IO Block: 4096 regular empty file&lt;BR /&gt;Device: fd06h/64774d Inode: 39 Links: 1&lt;BR /&gt;Access: (0644/-rw-r--r--) Uid: (31898/ missas) Gid: ( 342/ mismeta)&lt;BR /&gt;Access: 2016-05-17 03:30:34.054873628 -0400&lt;BR /&gt;Modify: 2016-05-17 03:30:34.054873628 -0400&lt;BR /&gt;Change: 2016-05-17 03:30:34.054873628 -0400&lt;BR /&gt; File: `/tmp/testfile'&lt;BR /&gt; Size: 352 Blocks: 8 IO Block: 4096 regular file&lt;BR /&gt;Device: fd06h/64774d Inode: 39 Links: 1&lt;BR /&gt;Access: (0644/-rw-r--r--) Uid: (31898/ missas) Gid: ( 342/ mismeta)&lt;BR /&gt;Access: 2016-05-17 03:30:34.054873628 -0400&lt;BR /&gt;Modify: 2016-05-17 03:30:34.057873708 -0400&lt;BR /&gt;Change: 2016-05-17 03:30:34.057873708 -0400&lt;/P&gt;</description>
      <pubDate>Tue, 17 May 2016 07:34:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/X-commands-how-do-they-work/m-p/270893#M5033</guid>
      <dc:creator>angian</dc:creator>
      <dc:date>2016-05-17T07:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: X commands, how do they work?</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/X-commands-how-do-they-work/m-p/270911#M5035</link>
      <description>&lt;P&gt;Aaaaaah....the touch command actually modifies the timestamp, I though just writing to the file would be enough. Thanks guys. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 May 2016 09:33:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/X-commands-how-do-they-work/m-p/270911#M5035</guid>
      <dc:creator>daearol</dc:creator>
      <dc:date>2016-05-17T09:33:43Z</dc:date>
    </item>
  </channel>
</rss>

