<?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: Question on using SFTP to rename a file at remote SFTP server after getting the file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Question-on-using-SFTP-to-rename-a-file-at-remote-SFTP-server/m-p/232960#M308408</link>
    <description>&lt;P&gt;Hi, thank you for sharing the code with me.. I have some problems on using the Filename &amp;nbsp;myfile Pipe statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I use this&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Filename SITE4 PIPE 'mv reports/Market_Summary_20151102.csv reports/Market_Summary_20151102.done'&lt;BR /&gt;&amp;nbsp; Host="142.199.199.199" user="userid" ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I received an error message tha Host and user are invalid option. It seems to me that host and user cannot use with pipe. If I don't define for SFTP server IP and user id, how can I rename the file&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I use this&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Filename SITE4 PIPE 'mv reports/Market_Summary_20151102.csv reports/Market_Summary_20151102.done'&amp;nbsp;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I received an error message that I have insufficient authority. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please advise and thank you for your help...&lt;/P&gt;</description>
    <pubDate>Tue, 03 Nov 2015 20:20:00 GMT</pubDate>
    <dc:creator>DennisLam</dc:creator>
    <dc:date>2015-11-03T20:20:00Z</dc:date>
    <item>
      <title>Question on using SFTP to rename a file at remote SFTP server after getting the file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-on-using-SFTP-to-rename-a-file-at-remote-SFTP-server/m-p/232929#M308406</link>
      <description>&lt;P&gt;Hi, I need to develop a SAS program to get a file from an remote SFTP server and rename the file after download the file. I can get the file but don't know how to send the UNIX rename command to the remote SFTP server to rename the file. Any suggestion?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Following is my code that I have developed and it works well:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Filename SITE1 SFTP "reports/Market_Summary_date..csv"&lt;BR /&gt;Host="142.199.199.199" user="user1" ;&lt;/P&gt;&lt;P&gt;data WORK.Market_DATA ;&lt;BR /&gt;%let _EFIERR_ = 0;&amp;nbsp;&lt;BR /&gt;infile site1 delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2;&lt;BR /&gt;informat REPORT_DATE yymmdd10. ;&lt;/P&gt;&lt;P&gt;format REPORT_DATE yymmdd10. ;&lt;/P&gt;&lt;P&gt;input&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;REPORT_DATE;&lt;/P&gt;&lt;P&gt;if _ERROR_ then call symputx('_EFIERR_',1);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Nov 2015 17:13:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-on-using-SFTP-to-rename-a-file-at-remote-SFTP-server/m-p/232929#M308406</guid>
      <dc:creator>DennisLam</dc:creator>
      <dc:date>2015-11-03T17:13:55Z</dc:date>
    </item>
    <item>
      <title>Re: Question on using SFTP to rename a file at remote SFTP server after getting the file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-on-using-SFTP-to-rename-a-file-at-remote-SFTP-server/m-p/232943#M308407</link>
      <description>&lt;P&gt;Hi mate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the filename statement to rename the file using a shell script command "mv".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you can use the following sintax:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename myfile pipe "mv myfile.txt newfile.txt";

/*or you can use the X command*/

x "mv myfile.txt newfile.txt";
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Once you have permission to execute shell scripts you can use filename, call system, or x command to execute Shell scripts from SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Check out some&amp;nbsp;&lt;A href="http://www.puzha.com/sasbook/unix%20for%20SAS%20analysts.html" target="_self"&gt;Shell commands&lt;/A&gt;&amp;nbsp;or&amp;nbsp;&lt;A href="http://support.sas.com/documentation/cdl/en/hostunx/61879/HTML/default/viewer.htm#xcomm.htm" target="_self"&gt;Executing Operating System Commands from Your SAS Session&lt;/A&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps&lt;/P&gt;</description>
      <pubDate>Tue, 03 Nov 2015 18:49:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-on-using-SFTP-to-rename-a-file-at-remote-SFTP-server/m-p/232943#M308407</guid>
      <dc:creator>DartRodrigo</dc:creator>
      <dc:date>2015-11-03T18:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: Question on using SFTP to rename a file at remote SFTP server after getting the file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-on-using-SFTP-to-rename-a-file-at-remote-SFTP-server/m-p/232960#M308408</link>
      <description>&lt;P&gt;Hi, thank you for sharing the code with me.. I have some problems on using the Filename &amp;nbsp;myfile Pipe statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I use this&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Filename SITE4 PIPE 'mv reports/Market_Summary_20151102.csv reports/Market_Summary_20151102.done'&lt;BR /&gt;&amp;nbsp; Host="142.199.199.199" user="userid" ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I received an error message tha Host and user are invalid option. It seems to me that host and user cannot use with pipe. If I don't define for SFTP server IP and user id, how can I rename the file&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I use this&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Filename SITE4 PIPE 'mv reports/Market_Summary_20151102.csv reports/Market_Summary_20151102.done'&amp;nbsp;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I received an error message that I have insufficient authority. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please advise and thank you for your help...&lt;/P&gt;</description>
      <pubDate>Tue, 03 Nov 2015 20:20:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-on-using-SFTP-to-rename-a-file-at-remote-SFTP-server/m-p/232960#M308408</guid>
      <dc:creator>DennisLam</dc:creator>
      <dc:date>2015-11-03T20:20:00Z</dc:date>
    </item>
    <item>
      <title>Re: Question on using SFTP to rename a file at remote SFTP server after getting the file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-on-using-SFTP-to-rename-a-file-at-remote-SFTP-server/m-p/233038#M308409</link>
      <description>&lt;P&gt;Hi mate,&lt;/P&gt;
&lt;P&gt;Once you are in the enviroment of this host you don't need to use these options.&lt;/P&gt;
&lt;P&gt;Your SAS is connected in this host, or it is another server ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;These are the questions that you might answer to select the option that you have to use.&lt;/P&gt;
&lt;P&gt;Pipe is used to the server you are connected.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe you should use instead of pipe use sftp and do the same.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this:&amp;nbsp;&lt;A href="https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003041481.htm" target="_self"&gt;FILENAME Statement, SFTP Access Method&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps&lt;/P&gt;</description>
      <pubDate>Wed, 04 Nov 2015 10:54:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-on-using-SFTP-to-rename-a-file-at-remote-SFTP-server/m-p/233038#M308409</guid>
      <dc:creator>DartRodrigo</dc:creator>
      <dc:date>2015-11-04T10:54:57Z</dc:date>
    </item>
  </channel>
</rss>

