<?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 Run Shell Script inside SAS? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-Run-Shell-Script-inside-SAS/m-p/549205#M276557</link>
    <description>&lt;UL&gt;
&lt;LI&gt;don't hijack a thread that's two years old. Almost nobody will see your question. Open your own thread in SAS Programming.&lt;/LI&gt;
&lt;LI&gt;in this new thread, post your whole log (from the filename statement to the ERROR message), using the {i} button.&lt;/LI&gt;
&lt;/UL&gt;</description>
    <pubDate>Mon, 08 Apr 2019 09:19:28 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-04-08T09:19:28Z</dc:date>
    <item>
      <title>How to Run Shell Script inside SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Run-Shell-Script-inside-SAS/m-p/375836#M276551</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to run a .sh file from sas. I tried the following&lt;/P&gt;&lt;PRE&gt;data _null_;
call system ('cd /users/smith/report.sh');
run;&lt;/PRE&gt;&lt;P&gt;But it is not executing my script .&lt;/P&gt;&lt;P&gt;Please help&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 21:15:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Run-Shell-Script-inside-SAS/m-p/375836#M276551</guid>
      <dc:creator>jjames1</dc:creator>
      <dc:date>2017-07-13T21:15:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to Run Shell Script inside SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Run-Shell-Script-inside-SAS/m-p/375838#M276552</link>
      <description>&lt;OL&gt;
&lt;LI&gt;"cd" is change directory.&amp;nbsp; It will not run the script.&lt;/LI&gt;
&lt;LI&gt;Have you tried the X statement?&amp;nbsp; It's a global statement (i.e. does not need to be (should not be)&amp;nbsp;inside a DATA step or other PROC step.&amp;nbsp;&amp;nbsp; See &lt;A href="http://www.sascommunity.org/wiki/X_statement" target="_blank"&gt;http://www.sascommunity.org/wiki/X_statement&lt;/A&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; x '/users/smith/report.sh' ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You also need to consider whether you want your SAS program to wait for the X statements complete or not.&amp;nbsp; If yes, then issue&lt;/P&gt;
&lt;P&gt;&amp;nbsp; options xwait;&lt;/P&gt;
&lt;P&gt;somewhere prior to the X statement(s).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If not&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;options noxwait;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note many sysadmins turn off the ability to issue X statements when configuring SAS.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 21:21:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Run-Shell-Script-inside-SAS/m-p/375838#M276552</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-07-13T21:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to Run Shell Script inside SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Run-Shell-Script-inside-SAS/m-p/375938#M276553</link>
      <description>&lt;P&gt;As &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt; already noted, cd won't run anything, it just (in UNIX) sets the current working directory of the shell (or, when submitted with x or call system(), the cwd of the SAS session).&lt;/P&gt;
&lt;P&gt;The best method for executing external programs is with a filename pipe:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename oscmd pipe "/users/smith/report.sh 2&amp;gt;&amp;amp;1";

data _null_;
infile oscmd;
input;
put _infile_;
run;

filename oscmd clear;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This will catch all output (including error messages from stderr, that's done with the 2&amp;gt;&amp;amp;1 redirection) from the external program in the SAS log.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2017 07:25:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Run-Shell-Script-inside-SAS/m-p/375938#M276553</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-07-14T07:25:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to Run Shell Script inside SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Run-Shell-Script-inside-SAS/m-p/375942#M276554</link>
      <description>&lt;P&gt;Could you please tell me why we use&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token string"&gt;2&amp;gt;&amp;amp;1?&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2017 07:47:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Run-Shell-Script-inside-SAS/m-p/375942#M276554</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2017-07-14T07:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to Run Shell Script inside SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Run-Shell-Script-inside-SAS/m-p/375943#M276555</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/8409"&gt;@Babloo&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Could you please tell me why we use&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token string"&gt;2&amp;gt;&amp;amp;1?&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You should start to read all of a post before answering/questioning:&lt;/P&gt;
&lt;P&gt;Quote from my post:&lt;/P&gt;
&lt;P&gt;(including error messages from &lt;STRONG&gt;stderr&lt;/STRONG&gt;, that's done with the &lt;STRONG&gt;2&amp;gt;&amp;amp;1&lt;/STRONG&gt; redirection)&lt;/P&gt;
&lt;P&gt;A google search for "2&amp;gt;&amp;amp;1" will give you extensive information for why it is done.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2017 08:16:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Run-Shell-Script-inside-SAS/m-p/375943#M276555</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-07-14T08:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to Run Shell Script inside SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Run-Shell-Script-inside-SAS/m-p/549201#M276556</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to execute a shell file from a SAS MACRO&lt;/P&gt;&lt;P&gt;I use below code:&lt;/P&gt;&lt;P&gt;filename runoc pipe "/test/space.try.sh";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get message saying there is no logical file name assign to runoc.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2019 08:18:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Run-Shell-Script-inside-SAS/m-p/549201#M276556</guid>
      <dc:creator>Smr1234</dc:creator>
      <dc:date>2019-04-08T08:18:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to Run Shell Script inside SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Run-Shell-Script-inside-SAS/m-p/549205#M276557</link>
      <description>&lt;UL&gt;
&lt;LI&gt;don't hijack a thread that's two years old. Almost nobody will see your question. Open your own thread in SAS Programming.&lt;/LI&gt;
&lt;LI&gt;in this new thread, post your whole log (from the filename statement to the ERROR message), using the {i} button.&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Mon, 08 Apr 2019 09:19:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Run-Shell-Script-inside-SAS/m-p/549205#M276557</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-04-08T09:19:28Z</dc:date>
    </item>
  </channel>
</rss>

