<?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 Move files between server using SFTP in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Move-files-between-server-using-SFTP/m-p/350673#M81534</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Hi there,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm new to SAS and I need to&amp;nbsp;export or some excel file on a remote server using sftp.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Currently I use the following command to create the files on a shared drive!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;PROC EXPORT DATA = Final_data&amp;nbsp;OUTFILE= "\\testfolder\DailyReport.xls"&lt;BR /&gt;DBMS=EXCEL REPLACE LABEL; SHEET="Data"; RUN;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;However the new approach is using sftp for the security purposes.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My first question is, is it possible to use sftp to create files on the remote server?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If not, I'm thinking of creating files on local server and move them using sftp to the destination server. So my second question is what is the command to transfer all files of one folder to the destination server using sftp and private key.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 18 Apr 2017 20:18:04 GMT</pubDate>
    <dc:creator>nedaha</dc:creator>
    <dc:date>2017-04-18T20:18:04Z</dc:date>
    <item>
      <title>Move files between server using SFTP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Move-files-between-server-using-SFTP/m-p/350673#M81534</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi there,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm new to SAS and I need to&amp;nbsp;export or some excel file on a remote server using sftp.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Currently I use the following command to create the files on a shared drive!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;PROC EXPORT DATA = Final_data&amp;nbsp;OUTFILE= "\\testfolder\DailyReport.xls"&lt;BR /&gt;DBMS=EXCEL REPLACE LABEL; SHEET="Data"; RUN;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;However the new approach is using sftp for the security purposes.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My first question is, is it possible to use sftp to create files on the remote server?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If not, I'm thinking of creating files on local server and move them using sftp to the destination server. So my second question is what is the command to transfer all files of one folder to the destination server using sftp and private key.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2017 20:18:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Move-files-between-server-using-SFTP/m-p/350673#M81534</guid>
      <dc:creator>nedaha</dc:creator>
      <dc:date>2017-04-18T20:18:04Z</dc:date>
    </item>
    <item>
      <title>Re: Move all files of one folder using sftp</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Move-files-between-server-using-SFTP/m-p/350737#M81557</link>
      <description>&lt;P&gt;The filename statement [&lt;A href="https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003041481.htm" target="_blank"&gt;https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003041481.htm&lt;/A&gt;] can establish a connection to a sftp-server.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename narf sftp "DailyReport.xls" host="..." ...;

proc export outfile=narf ...;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Apr 2017 07:56:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Move-files-between-server-using-SFTP/m-p/350737#M81557</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2017-04-18T07:56:04Z</dc:date>
    </item>
    <item>
      <title>Re: Move all files of one folder using sftp</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Move-files-between-server-using-SFTP/m-p/351026#M81671</link>
      <description>&lt;P&gt;Thanks for the resources Ansreas.&lt;/P&gt;&lt;P&gt;I review the filename statement help and create the following code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;filename outfile sftp 'test.csv' CD ='/Class/' host="IPAddress" user="UserName" options='-p = 1000 -i = c:/PrivateKey.ppk'  DEBUG  ;
run;
PROC EXPORT 						
Data = info /* This is the dataset name */
	OUTFILE= outfile
	DBMS=csv REPLACE;
run;&lt;/PRE&gt;&lt;P&gt;After the code is ran&amp;nbsp;the following error occured.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;NOTE: psftp: unknown option "-p"
try typing "psftp -h" for help
NOTE: cd /Class/
ERROR: .&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The version of sas is 9.3&lt;/P&gt;&lt;P&gt;The source os is windows and sftp server is unix.&lt;/P&gt;&lt;P&gt;I also tried -oport instead of -p but it didn't work!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I remove the port option I'll see the following error!&lt;/P&gt;&lt;PRE&gt;NOTE: PuTTY Secure File Transfer (SFTP) client
Release 0.68
Usage: psftp [options]
      [user@]host
Options:
  -V        print version information and exit
  -pgpfp    print
      PGP key fingerprints and exit
  -b file   use specified batchfile
  -bc       output
      batchfile commands
  -be       don't stop batchfile processing if errors
  -v
      show verbose messages
  -load sessname  Load settings from saved session
  -l user
      connect with specified username
  -P port   connect to specified port
  -pw passw
      login with specified password
  -1 -2     force use of particular SSH protocol
      version
  -4 -6     force use of IPv4 or IPv6
  -C        enable compression
  -i key
         private key file for user authentication
  -noagent  disable use of Pageant

      -agent    enable use of Pageant
  -hostkey aa:bb:cc:...
            manually specify a
      host key (may be repeated)
  -batch    disable all interactive prompts
  -proxycmd
      command
            use 'command' as local proxy
  -sshlog file
  -sshrawlog file

               log protocol details to a file

ERROR: Public Key Authentication is required, Password validation is not supported.
ERROR: For further debugging assistance, insert the PSFTP verbose parameter "options="-v " and
the "debug" option on the Filename sftp statement and review the SAS log.
ERROR: .&lt;/PRE&gt;&lt;P&gt;Any suggestion?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2017 20:16:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Move-files-between-server-using-SFTP/m-p/351026#M81671</guid>
      <dc:creator>nedaha</dc:creator>
      <dc:date>2017-04-18T20:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: Move all files of one folder using sftp</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Move-files-between-server-using-SFTP/m-p/352834#M82302</link>
      <description>&lt;P&gt;I just moved the options before the host and it fixed the issue!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename outfile sftp 'test.csv' CD ='/Class/'  &lt;STRONG&gt;options="-p = 1000 -i = c:/PrivateKey.ppk"&lt;/STRONG&gt; host="IPAddress" user="UserName"  DEBUG  ;
&lt;BR /&gt;PROC EXPORT &lt;BR /&gt;Data = info /* This is the dataset name */&lt;BR /&gt; OUTFILE= outfile&lt;BR /&gt; DBMS=csv REPLACE;&lt;BR /&gt;run;
&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2017 14:44:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Move-files-between-server-using-SFTP/m-p/352834#M82302</guid>
      <dc:creator>nedaha</dc:creator>
      <dc:date>2017-04-24T14:44:51Z</dc:date>
    </item>
  </channel>
</rss>

