<?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: Execute python script within SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Execute-python-script-within-SAS/m-p/637496#M189484</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;P&gt;Our company's engineering department developed a python script API to be used by clients.&amp;nbsp; Our department has be asked to verify the results.&amp;nbsp; There is a wide range of input possibilities so we would like to use SAS to create the formatted file of input and parse the output file for analyses.&amp;nbsp; We are running SAS 9.4.&amp;nbsp; I am trying the x command, and the python window flashes and an output file is created but is empty.&amp;nbsp; I am left with a Windows open box with c:\users\ajohnson open.&amp;nbsp; I have run the input file through a Windows bat command file and interactive python and the file is created and populated.&amp;nbsp; below are the x command and input py file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;x 'START /WAIT "C:\Python27\python.exe" "R:\API tests\temp_new.py" &amp;gt; "R:\API tests\temp_out_new2.txt" ';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions of how to get the python script to show any error messages?&amp;nbsp; How do I get the output file with results?&amp;nbsp; Do I need to change "print results" to another python command?&amp;nbsp; How do I get the addditonal open box closed so I can run the SAS code in batch?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Check this - &lt;A href="https://communities.sas.com/t5/SAS-Programming/Executing-python-script-in-SAS/m-p/393304#M94702" target="_blank" rel="noopener"&gt;View solution in original post&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Hope this will help you.&lt;/P&gt;</description>
    <pubDate>Sat, 04 Apr 2020 04:01:58 GMT</pubDate>
    <dc:creator>enatx</dc:creator>
    <dc:date>2020-04-04T04:01:58Z</dc:date>
    <item>
      <title>Execute python script within SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Execute-python-script-within-SAS/m-p/637303#M189447</link>
      <description>&lt;P&gt;Our company's engineering department developed a python script API to be used by clients.&amp;nbsp; Our department has be asked to verify the results.&amp;nbsp; There is a wide range of input possibilities so we would like to use SAS to create the formatted file of input and parse the output file for analyses.&amp;nbsp; We are running SAS 9.4.&amp;nbsp; I am trying the x command, and the python window flashes and an output file is created but is empty.&amp;nbsp; I am left with a Windows open box with c:\users\ajohnson open.&amp;nbsp; I have run the input file through a Windows bat command file and interactive python and the file is created and populated.&amp;nbsp; below are the x command and input py file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;x 'START /WAIT "C:\Python27\python.exe" "R:\API tests\temp_new.py" &amp;gt; "R:\API tests\temp_out_new2.txt" ';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions of how to get the python script to show any error messages?&amp;nbsp; How do I get the output file with results?&amp;nbsp; Do I need to change "print results" to another python command?&amp;nbsp; How do I get the addditonal open box closed so I can run the SAS code in batch?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 16:34:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Execute-python-script-within-SAS/m-p/637303#M189447</guid>
      <dc:creator>AllenJ</dc:creator>
      <dc:date>2020-04-03T16:34:26Z</dc:date>
    </item>
    <item>
      <title>Re: Execute python script within SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Execute-python-script-within-SAS/m-p/637367#M189462</link>
      <description>&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/22361916/workaround-for-noxsync-not-behaving-as-required-in-sas" target="_self"&gt;This discussion&lt;/A&gt; should interest you.&lt;/P&gt;
&lt;P&gt;In particular, see what settings you have for options &lt;FONT face="courier new,courier"&gt;xwait&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;xsync&lt;/FONT&gt;, and try using a batch file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, consider using&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;filename CMD pipe "OS command";&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;data _null_;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; infile CMD;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; input;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; put _infile_; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;instead of&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;x "OS command";&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;to capture the text returned by the OS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 21:55:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Execute-python-script-within-SAS/m-p/637367#M189462</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-04-03T21:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: Execute python script within SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Execute-python-script-within-SAS/m-p/637496#M189484</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;P&gt;Our company's engineering department developed a python script API to be used by clients.&amp;nbsp; Our department has be asked to verify the results.&amp;nbsp; There is a wide range of input possibilities so we would like to use SAS to create the formatted file of input and parse the output file for analyses.&amp;nbsp; We are running SAS 9.4.&amp;nbsp; I am trying the x command, and the python window flashes and an output file is created but is empty.&amp;nbsp; I am left with a Windows open box with c:\users\ajohnson open.&amp;nbsp; I have run the input file through a Windows bat command file and interactive python and the file is created and populated.&amp;nbsp; below are the x command and input py file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;x 'START /WAIT "C:\Python27\python.exe" "R:\API tests\temp_new.py" &amp;gt; "R:\API tests\temp_out_new2.txt" ';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions of how to get the python script to show any error messages?&amp;nbsp; How do I get the output file with results?&amp;nbsp; Do I need to change "print results" to another python command?&amp;nbsp; How do I get the addditonal open box closed so I can run the SAS code in batch?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Check this - &lt;A href="https://communities.sas.com/t5/SAS-Programming/Executing-python-script-in-SAS/m-p/393304#M94702" target="_blank" rel="noopener"&gt;View solution in original post&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Hope this will help you.&lt;/P&gt;</description>
      <pubDate>Sat, 04 Apr 2020 04:01:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Execute-python-script-within-SAS/m-p/637496#M189484</guid>
      <dc:creator>enatx</dc:creator>
      <dc:date>2020-04-04T04:01:58Z</dc:date>
    </item>
  </channel>
</rss>

