<?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 use a call execute to pass a unix command in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-use-a-call-execute-to-pass-a-unix-command/m-p/915916#M44301</link>
    <description>&lt;P&gt;CALL EXECUTE() is for submitting SAS code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To run an operating system command (so if your SAS session is running on UNIX then it could be a UNXI command) you can use a PIPE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To use an existing variable as the source of the filename (the string that will the command run in the pipe) use the FILEVAR= option of the INFILE statement.&amp;nbsp; To see if the command tries to send back any messages just read the lines it writes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if variable UNIXCOMMAND in the dataset FILELISTING has the commands to run then you want something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_; 
  set filelisting;
  infile unix pipe filevar=unixcommand end=eof;
  do while (not eof);
    input;
    put _infile_;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 13 Feb 2024 20:22:40 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2024-02-13T20:22:40Z</dc:date>
    <item>
      <title>how to use a call execute to pass a unix command</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-use-a-call-execute-to-pass-a-unix-command/m-p/915914#M44300</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a dataset name filelisting.&amp;nbsp; One of its variable is unixcommand and the first observation look like below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;sed -i 's/"prod@test.net"//g' /.../sasmacro/email.sas&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if I execute the above unix command directrly on the terminal via winscp, its works very well and it erase the sting&amp;nbsp;"prod@test.net" from email.sas&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How do we passed this unix command using&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;set filelisting;&lt;/P&gt;
&lt;P&gt;call execute('something');&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 19:59:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-use-a-call-execute-to-pass-a-unix-command/m-p/915914#M44300</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2024-02-13T19:59:07Z</dc:date>
    </item>
    <item>
      <title>Re: how to use a call execute to pass a unix command</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-use-a-call-execute-to-pass-a-unix-command/m-p/915916#M44301</link>
      <description>&lt;P&gt;CALL EXECUTE() is for submitting SAS code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To run an operating system command (so if your SAS session is running on UNIX then it could be a UNXI command) you can use a PIPE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To use an existing variable as the source of the filename (the string that will the command run in the pipe) use the FILEVAR= option of the INFILE statement.&amp;nbsp; To see if the command tries to send back any messages just read the lines it writes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if variable UNIXCOMMAND in the dataset FILELISTING has the commands to run then you want something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_; 
  set filelisting;
  infile unix pipe filevar=unixcommand end=eof;
  do while (not eof);
    input;
    put _infile_;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 20:22:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-use-a-call-execute-to-pass-a-unix-command/m-p/915916#M44301</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-02-13T20:22:40Z</dc:date>
    </item>
    <item>
      <title>Re: how to use a call execute to pass a unix command</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-use-a-call-execute-to-pass-a-unix-command/m-p/915921#M44302</link>
      <description>&lt;P&gt;Thank you very much&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 20:42:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-use-a-call-execute-to-pass-a-unix-command/m-p/915921#M44302</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2024-02-13T20:42:26Z</dc:date>
    </item>
    <item>
      <title>Re: how to use a call execute to pass a unix command</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-use-a-call-execute-to-pass-a-unix-command/m-p/915922#M44303</link>
      <description>&lt;P&gt;Left off the DO of the DO WHILE statement.&amp;nbsp; I will correct in the original post.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 20:22:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-use-a-call-execute-to-pass-a-unix-command/m-p/915922#M44303</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-02-13T20:22:20Z</dc:date>
    </item>
  </channel>
</rss>

