<?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: Copy binary files from SAS to FTP server in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Copy-binary-files-from-SAS-to-FTP-server/m-p/569483#M160493</link>
    <description>&lt;P&gt;To use secure ftp, you should first set up passwordless authentication. Create a public/private key pair with ssh-keygen, then copy the public key to the server, and add it there to $HOME/.ssh/authorized_keys. Put the private key in you local .ssh directory. This is important because you have no way to enter a password to the external command.&lt;/P&gt;
&lt;P&gt;Then you can start with the following:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let local_path=local path;
%let remote_path=remote path on the server;
%let sftp_server=hostname or IP of the server;
%let user=username on remote server;

data _null_;
set tbl_00001;
call execute("scp &amp;amp;local_path./" !! trim(arq) !! " &amp;amp;user.@&amp;amp;sftp_server.:&amp;amp;remote_path./" !! trim(arq));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 27 Jun 2019 15:13:19 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-06-27T15:13:19Z</dc:date>
    <item>
      <title>Copy binary files from SAS to FTP server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-binary-files-from-SAS-to-FTP-server/m-p/569428#M160466</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to upload some PDF files generated in SAS to our FTP server to be available for users to see them through a web application. I have tried to do that using the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;filename outfile ftp new
     host='10.10.12.100'
     user='user'
     pass='123456'
     rcmd='chmod 0644'&lt;BR /&gt;     recmf=F;

data _null_;
    set work.tbl_00001 (where=(nm_an eq 'Form'));
file outfile filevar=arq;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The above code is generating an error as follow:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ERROR: Insufficient authorization to access /opt/sas94config_anl03/SASApp/15_898699232_217510.pdf&lt;/PRE&gt;&lt;P&gt;As far as I think, the file might be saved to FTP server, but as the error message state seems the SAS is saving them to the local server rather than in the FTP server.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I missing here? Any idea how to solve this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Marcio&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 13:58:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-binary-files-from-SAS-to-FTP-server/m-p/569428#M160466</guid>
      <dc:creator>mslino</dc:creator>
      <dc:date>2019-06-27T13:58:37Z</dc:date>
    </item>
    <item>
      <title>Re: Copy binary files from SAS to FTP server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-binary-files-from-SAS-to-FTP-server/m-p/569433#M160469</link>
      <description>&lt;P&gt;filevar= is an option that enables a data step to create multiple output TEXT(!) files in one run. The file reference used in the file statement is only a placeholder, a dummy.&lt;/P&gt;
&lt;P&gt;I guess that arq contains filenames without an absolute path, so SAS tries to create those files in its current working directory, which is&lt;/P&gt;
&lt;PRE&gt;/opt/sas94config_anl03/SASApp&lt;/PRE&gt;
&lt;P&gt;according to your SAS setup.&lt;/P&gt;
&lt;P&gt;Since this CWD is from a UNIX system, you should be able to use scp in an external command to copy your pdf files to the server.&lt;/P&gt;
&lt;P&gt;I am astounded that you still use ftp for non-anonymous access. That's a catastrophic security hole, as credentials are sent over the network without encryption. Switch to SSH for non-anonymous data transfer 10 years before yesterday.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 15:01:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-binary-files-from-SAS-to-FTP-server/m-p/569433#M160469</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-06-27T15:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: Copy binary files from SAS to FTP server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-binary-files-from-SAS-to-FTP-server/m-p/569450#M160476</link>
      <description>&lt;P&gt;Hi Kurt,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the heads up regarding FTP protocol.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Marcio&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 14:34:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-binary-files-from-SAS-to-FTP-server/m-p/569450#M160476</guid>
      <dc:creator>mslino</dc:creator>
      <dc:date>2019-06-27T14:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: Copy binary files from SAS to FTP server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-binary-files-from-SAS-to-FTP-server/m-p/569475#M160490</link>
      <description>&lt;P&gt;What file are you trying to move?&amp;nbsp; I don't see any files or any attempt to move any files.&lt;/P&gt;
&lt;P&gt;You can use the FILE statement in a data step to tell SAS where to send the lines you create with PUT statements in that data step. But your data step doesn't have any PUT statement.&lt;/P&gt;
&lt;P&gt;Does your dataset have a list of filenames?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note the error is because the FILEVAR= option is telling the FILE statement to write to the files named in the variable specified so it is trying to open those files for output.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 15:03:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-binary-files-from-SAS-to-FTP-server/m-p/569475#M160490</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-06-27T15:03:21Z</dc:date>
    </item>
    <item>
      <title>Re: Copy binary files from SAS to FTP server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-binary-files-from-SAS-to-FTP-server/m-p/569483#M160493</link>
      <description>&lt;P&gt;To use secure ftp, you should first set up passwordless authentication. Create a public/private key pair with ssh-keygen, then copy the public key to the server, and add it there to $HOME/.ssh/authorized_keys. Put the private key in you local .ssh directory. This is important because you have no way to enter a password to the external command.&lt;/P&gt;
&lt;P&gt;Then you can start with the following:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let local_path=local path;
%let remote_path=remote path on the server;
%let sftp_server=hostname or IP of the server;
%let user=username on remote server;

data _null_;
set tbl_00001;
call execute("scp &amp;amp;local_path./" !! trim(arq) !! " &amp;amp;user.@&amp;amp;sftp_server.:&amp;amp;remote_path./" !! trim(arq));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 15:13:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-binary-files-from-SAS-to-FTP-server/m-p/569483#M160493</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-06-27T15:13:19Z</dc:date>
    </item>
    <item>
      <title>Re: Copy binary files from SAS to FTP server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-binary-files-from-SAS-to-FTP-server/m-p/569539#M160510</link>
      <description>&lt;P&gt;Hi&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have some PDF files located in my SAS server that I would like to copy or upload to another server. Note that are separated hosts (SAS server is an IBM AIX machine and FTP server is a Virtual SUSE machine).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since the servers are in different IPs, I&amp;nbsp;thought that was possible to transfer the physical PDF file from SAS server to SUSE server and use a web application to show the those PDF in a browser only to our internal network.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That dataset &lt;STRONG&gt;(work.tbl_00001)&lt;/STRONG&gt; Shown in the code contains the path (arq) where SAS has already save the PDF file, e.g.,&lt;EM&gt;/data/gcont/Temp/15_90456789_876543.pdf&lt;/EM&gt;.&amp;nbsp; I want to copy each PDF that matches the criteria to our SUSE FTP server.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Marcio&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 17:10:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-binary-files-from-SAS-to-FTP-server/m-p/569539#M160510</guid>
      <dc:creator>mslino</dc:creator>
      <dc:date>2019-06-27T17:10:45Z</dc:date>
    </item>
    <item>
      <title>Re: Copy binary files from SAS to FTP server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-binary-files-from-SAS-to-FTP-server/m-p/569544#M160513</link>
      <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your solution is what I need, but I have limited access to our SAS server. Where did I need to put the private key? I use SAS Guide to have access to our SAS server.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Marcio&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 17:27:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-binary-files-from-SAS-to-FTP-server/m-p/569544#M160513</guid>
      <dc:creator>mslino</dc:creator>
      <dc:date>2019-06-27T17:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: Copy binary files from SAS to FTP server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-binary-files-from-SAS-to-FTP-server/m-p/569556#M160521</link>
      <description>&lt;P&gt;Since your SAS runs on AIX, you can use putty to log on to it. AIX always has SSH server processes.&lt;/P&gt;
&lt;P&gt;The &lt;A href="https://www.ssh.com/ssh/keygen/" target="_blank" rel="noopener"&gt;online documentation of ssh-keygen&lt;/A&gt; describes the process.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 17:48:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-binary-files-from-SAS-to-FTP-server/m-p/569556#M160521</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-06-27T17:48:10Z</dc:date>
    </item>
  </channel>
</rss>

