<?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 do I transfer csv files from Sas server location to DB server location in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-transfer-csv-files-from-Sas-server-location-to-DB/m-p/415774#M280164</link>
    <description>&lt;P&gt;In order for filename sftp to work, you need to set up passwordless authentication and initialize the known_hosts entry.&lt;/P&gt;
&lt;P&gt;On your SAS server, log on with your SAS user.&lt;/P&gt;
&lt;P&gt;Use ssh-keygen to create a public/private key pair. This will create files in .ssh:&lt;/P&gt;
&lt;PRE&gt;id_dsa
id_dsa.pub
id_rsa
id_rsa.pub&lt;/PRE&gt;
&lt;P&gt;(rsa or dsa depending on which method you chose)&lt;/P&gt;
&lt;P&gt;Change to directory .ssh&lt;/P&gt;
&lt;P&gt;Enter&lt;/P&gt;
&lt;PRE&gt;sftp username@10.20.30.50&lt;/PRE&gt;
&lt;P&gt;You will be prompted to accept a host verification key. After doing that, 10.20.30.50 will be in your .ssh/known_hosts file with this key. In the future, ssh will check if the target host is still the same, to prevent a MITM attack.&lt;/P&gt;
&lt;P&gt;After logging on (here you still need the password for username on 10.20.30.50), change to .ssh&lt;/P&gt;
&lt;P&gt;use the put subcommand to copy your .pub file to the server, change the target name, so you do not accidentally overwrite a file already there.&lt;/P&gt;
&lt;P&gt;log off, and log on with ssh&lt;/P&gt;
&lt;P&gt;change to .ssh&lt;/P&gt;
&lt;P&gt;Now, either rename your copied file to&lt;/P&gt;
&lt;PRE&gt;authorized_keys&lt;/PRE&gt;
&lt;P&gt;or append its contents to the file, if it already exists:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;cat authorized_keys your_file &amp;gt; authorized_keys.new
rm authorized_keys
mv authorized_keys.new authorized_keys&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;While doing this, make sure that all files and the .ssh directory are read/writable only by the user&lt;/P&gt;
&lt;P&gt;Log off and try ssh username@10.20.30.50 again. You should log on without being prompted for a password.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now you can use filename sftp on that server from SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 23 Nov 2017 08:51:09 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-11-23T08:51:09Z</dc:date>
    <item>
      <title>How do I transfer csv files from Sas server location to DB server location</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-transfer-csv-files-from-Sas-server-location-to-DB/m-p/415727#M280163</link>
      <description>&lt;P&gt;Hello Everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am stuck at a point where I need to transfer CSV files generated from sas to db server location. Below are the details:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using Sas 9.4 and below process will be run on batch via control M.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS server: 10.20.30.40&lt;/P&gt;
&lt;P&gt;Csv file location: /sasdata/test.csv&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Db server: 10.20.30.50&lt;/P&gt;
&lt;P&gt;Csv transfer location: /test1/test2/test.csv&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tried "filename outfile sftp" but stuck at primary key think (no knowledge about this).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is the code that I tried:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Filename outfile sftp 'test.csv' cd='/test1/test2/'&lt;/P&gt;
&lt;P&gt;Host='10.20.30.50' options="-oport=22" user="username" debug;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc export data=test outfile=outfile dbms=csv replace ;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Error: host key verification failed. Couldn't read packet: connection reset by peer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please provide your valuable suggestions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 23 Nov 2017 02:14:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-transfer-csv-files-from-Sas-server-location-to-DB/m-p/415727#M280163</guid>
      <dc:creator>samgautam007</dc:creator>
      <dc:date>2017-11-23T02:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do I transfer csv files from Sas server location to DB server location</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-transfer-csv-files-from-Sas-server-location-to-DB/m-p/415774#M280164</link>
      <description>&lt;P&gt;In order for filename sftp to work, you need to set up passwordless authentication and initialize the known_hosts entry.&lt;/P&gt;
&lt;P&gt;On your SAS server, log on with your SAS user.&lt;/P&gt;
&lt;P&gt;Use ssh-keygen to create a public/private key pair. This will create files in .ssh:&lt;/P&gt;
&lt;PRE&gt;id_dsa
id_dsa.pub
id_rsa
id_rsa.pub&lt;/PRE&gt;
&lt;P&gt;(rsa or dsa depending on which method you chose)&lt;/P&gt;
&lt;P&gt;Change to directory .ssh&lt;/P&gt;
&lt;P&gt;Enter&lt;/P&gt;
&lt;PRE&gt;sftp username@10.20.30.50&lt;/PRE&gt;
&lt;P&gt;You will be prompted to accept a host verification key. After doing that, 10.20.30.50 will be in your .ssh/known_hosts file with this key. In the future, ssh will check if the target host is still the same, to prevent a MITM attack.&lt;/P&gt;
&lt;P&gt;After logging on (here you still need the password for username on 10.20.30.50), change to .ssh&lt;/P&gt;
&lt;P&gt;use the put subcommand to copy your .pub file to the server, change the target name, so you do not accidentally overwrite a file already there.&lt;/P&gt;
&lt;P&gt;log off, and log on with ssh&lt;/P&gt;
&lt;P&gt;change to .ssh&lt;/P&gt;
&lt;P&gt;Now, either rename your copied file to&lt;/P&gt;
&lt;PRE&gt;authorized_keys&lt;/PRE&gt;
&lt;P&gt;or append its contents to the file, if it already exists:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;cat authorized_keys your_file &amp;gt; authorized_keys.new
rm authorized_keys
mv authorized_keys.new authorized_keys&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;While doing this, make sure that all files and the .ssh directory are read/writable only by the user&lt;/P&gt;
&lt;P&gt;Log off and try ssh username@10.20.30.50 again. You should log on without being prompted for a password.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now you can use filename sftp on that server from SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Nov 2017 08:51:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-transfer-csv-files-from-Sas-server-location-to-DB/m-p/415774#M280164</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-11-23T08:51:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do I transfer csv files from Sas server location to DB server location</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-transfer-csv-files-from-Sas-server-location-to-DB/m-p/416232#M280165</link>
      <description>&lt;P&gt;Thank so much&amp;nbsp;&lt;SPAN class="login-bold"&gt;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562" target="_self"&gt;KurtBremser&lt;/A&gt;&amp;nbsp;... it worked smoothly.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;Sandeep&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2017 01:46:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-transfer-csv-files-from-Sas-server-location-to-DB/m-p/416232#M280165</guid>
      <dc:creator>samgautam007</dc:creator>
      <dc:date>2017-11-27T01:46:48Z</dc:date>
    </item>
  </channel>
</rss>

