<?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: Call python with parameters for each row of SAS dataset in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Call-python-with-parameters-for-each-row-of-SAS-dataset/m-p/886611#M43368</link>
    <description>Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;, it works your solution. Only in my system expects parenthesis in:&lt;BR /&gt;do while (not(eof));&lt;BR /&gt;Regards</description>
    <pubDate>Thu, 27 Jul 2023 09:49:48 GMT</pubDate>
    <dc:creator>MM88</dc:creator>
    <dc:date>2023-07-27T09:49:48Z</dc:date>
    <item>
      <title>Call python with parameters for each row of SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Call-python-with-parameters-for-each-row-of-SAS-dataset/m-p/886441#M43360</link>
      <description>&lt;P&gt;Hi community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to call a python program for each row of my dataset. My dataset has 4 variables, that I need to pass as parameters to the python call.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data _null_;
  set mydataset;
  command = 'python C:\temp\mypython.py ' || " " || quote(strip(var1)) || " " || quote(var2) || " " || quote(var3) || " " || quote(var4);
  X command;
run;&lt;/PRE&gt;&lt;P&gt;But no python call is executed.&lt;/P&gt;&lt;P&gt;Any suggestions of what could be the problem?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2023 14:25:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Call-python-with-parameters-for-each-row-of-SAS-dataset/m-p/886441#M43360</guid>
      <dc:creator>MM88</dc:creator>
      <dc:date>2023-07-26T14:25:27Z</dc:date>
    </item>
    <item>
      <title>Re: Call python with parameters for each row of SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Call-python-with-parameters-for-each-row-of-SAS-dataset/m-p/886460#M43361</link>
      <description>&lt;P&gt;That is not how the X (aka SYSTEM) command works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could do it with a pipe instead.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set mydataset;
  length command $200;
  command = catx(' ','python C:\temp\mypython.py',quote(trim(var1)),quote(trim(var2)),quote(trim(var3)),quote(trim(var4)));
  infile cmd pipe filevar=command end=eof;
  do while not(eof);
    input;
    put _infile_;
  end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 26 Jul 2023 15:19:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Call-python-with-parameters-for-each-row-of-SAS-dataset/m-p/886460#M43361</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-07-26T15:19:57Z</dc:date>
    </item>
    <item>
      <title>Re: Call python with parameters for each row of SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Call-python-with-parameters-for-each-row-of-SAS-dataset/m-p/886611#M43368</link>
      <description>Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;, it works your solution. Only in my system expects parenthesis in:&lt;BR /&gt;do while (not(eof));&lt;BR /&gt;Regards</description>
      <pubDate>Thu, 27 Jul 2023 09:49:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Call-python-with-parameters-for-each-row-of-SAS-dataset/m-p/886611#M43368</guid>
      <dc:creator>MM88</dc:creator>
      <dc:date>2023-07-27T09:49:48Z</dc:date>
    </item>
    <item>
      <title>Re: Call python with parameters for each row of SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Call-python-with-parameters-for-each-row-of-SAS-dataset/m-p/886619#M43369</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*
You could make a BAT file and execute it by X command.
*/
filename x 'c:\temp\run.bat';   /*&amp;lt;--Here is a BAT file to run SHELL command*/
data _null_;
  set mydataset;
  command = 'python C:\temp\mypython.py ' || " " || quote(strip(var1)) || " " || quote(var2) || " " || quote(var3) || " " || quote(var4);
file x;
put command ;
run;

options noxwait;
X 'c:\temp\run.bat';  /*&amp;lt;--Here is a BAT file to run SHELL command*/&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Jul 2023 11:54:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Call-python-with-parameters-for-each-row-of-SAS-dataset/m-p/886619#M43369</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-07-27T11:54:01Z</dc:date>
    </item>
  </channel>
</rss>

