<?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 Shell command from SAS-EG in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Shell-command-from-SAS-EG/m-p/421203#M103622</link>
    <description>&lt;P&gt;Hi There,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do have a perfectly fine working shell command:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ssh johndoe@some.server.com &amp;gt; /home/some/path/test42.txt&amp;nbsp; mysql -u johnny -psomeawkwardpassword &amp;gt; /home/some/path/test42.txt &amp;lt;&amp;lt;&amp;lt; "select * from information_schema.TABLES WHERE table_schema = 'some_value' "&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When running in a shell, I get the executed query results written to the text file "test42.txt"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, when I try to execute this shell command from within SAS-EG I get a &amp;amp;sysrc=2 !&lt;/P&gt;&lt;P&gt;(Unfortunately, the SAS log does not include error messages from the operating system (or any output done to stdout and stderr) during execution of the shell command)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the SAS-Log, however, I do not get any kind of error or warning whatsoever!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using %sysexec:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%sysexec  &lt;BR /&gt;%unquote(%nrbquote(&lt;BR /&gt;ssh johndoe@some.server.com &lt;BR /&gt;mysql -u johnny -psomeawkwardpassword &amp;gt; /home/some/path/test42.txt &lt;BR /&gt;&amp;lt;&amp;lt;&amp;lt; "select * from information_schema.TABLES WHERE table_schema = 'some_value' "))&lt;BR /&gt;;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the correct SAS-EG syntax?&lt;/P&gt;</description>
    <pubDate>Thu, 14 Dec 2017 15:28:27 GMT</pubDate>
    <dc:creator>FK1</dc:creator>
    <dc:date>2017-12-14T15:28:27Z</dc:date>
    <item>
      <title>Shell command from SAS-EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Shell-command-from-SAS-EG/m-p/421203#M103622</link>
      <description>&lt;P&gt;Hi There,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do have a perfectly fine working shell command:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ssh johndoe@some.server.com &amp;gt; /home/some/path/test42.txt&amp;nbsp; mysql -u johnny -psomeawkwardpassword &amp;gt; /home/some/path/test42.txt &amp;lt;&amp;lt;&amp;lt; "select * from information_schema.TABLES WHERE table_schema = 'some_value' "&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When running in a shell, I get the executed query results written to the text file "test42.txt"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, when I try to execute this shell command from within SAS-EG I get a &amp;amp;sysrc=2 !&lt;/P&gt;&lt;P&gt;(Unfortunately, the SAS log does not include error messages from the operating system (or any output done to stdout and stderr) during execution of the shell command)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the SAS-Log, however, I do not get any kind of error or warning whatsoever!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using %sysexec:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%sysexec  &lt;BR /&gt;%unquote(%nrbquote(&lt;BR /&gt;ssh johndoe@some.server.com &lt;BR /&gt;mysql -u johnny -psomeawkwardpassword &amp;gt; /home/some/path/test42.txt &lt;BR /&gt;&amp;lt;&amp;lt;&amp;lt; "select * from information_schema.TABLES WHERE table_schema = 'some_value' "))&lt;BR /&gt;;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the correct SAS-EG syntax?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 15:28:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Shell-command-from-SAS-EG/m-p/421203#M103622</guid>
      <dc:creator>FK1</dc:creator>
      <dc:date>2017-12-14T15:28:27Z</dc:date>
    </item>
    <item>
      <title>Re: Shell command from SAS-EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Shell-command-from-SAS-EG/m-p/421222#M103629</link>
      <description>&lt;P&gt;I don't think this is a syntax error.&lt;/P&gt;&lt;P&gt;Check the value of the SAS option XCMD. If it is set to NOXCMD then you are prevented from issuing shell commands. You may be able to reset it to XCMD but your sys admin may have prevented this.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 15:55:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Shell-command-from-SAS-EG/m-p/421222#M103629</guid>
      <dc:creator>lethcons</dc:creator>
      <dc:date>2017-12-14T15:55:23Z</dc:date>
    </item>
    <item>
      <title>Re: Shell command from SAS-EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Shell-command-from-SAS-EG/m-p/421229#M103630</link>
      <description>&lt;P&gt;I checked it. It is turned on, i.e. I can send x commands from within SAS-EG:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cxmd-option.JPG" style="width: 594px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/17236iF4A97A219E24BAEA/image-size/large?v=v2&amp;amp;px=999" role="button" title="cxmd-option.JPG" alt="cxmd-option.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 16:04:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Shell-command-from-SAS-EG/m-p/421229#M103630</guid>
      <dc:creator>FK1</dc:creator>
      <dc:date>2017-12-14T16:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: Shell command from SAS-EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Shell-command-from-SAS-EG/m-p/421237#M103631</link>
      <description>&lt;P&gt;A small step to try ... this particular command does not require %nrbquote.&amp;nbsp; Try getting rid of %unquote and %nrbquote and the two sets of parentheses and see if that improves the information you receive about where the problem lies.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 16:20:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Shell-command-from-SAS-EG/m-p/421237#M103631</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-12-14T16:20:58Z</dc:date>
    </item>
  </channel>
</rss>

