<?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: Transfer file SFTP | Filename in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Transfer-file-SFTP-Filename/m-p/721537#M223660</link>
    <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13728"&gt;@SASJedi&lt;/a&gt;&amp;nbsp;, I double check and the file on SAS server exist and it's in the correct location but still the same error appears.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's like the process tried to read from SFTP instead of write:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename archivo sftp "/my directory/TEST_DESCONSIDERAR.txt"  host='XX.XX.XX.XX'
user='myuser' optionsx=' -pw "myPassword"' DEBUG recfm=v;  

filename test '/work_SAS/test.txt';

data _null_;
infile test recfm=n ;
input;
file archivo  ;
put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;NOTE: UNBUFFERED is the default with RECFM=N.
NOTE: The infile TEST is:
      Filename=/work_SAS/test.txt,
      Owner Name=sas,Group Name=sas,
      Access Permission=-rw-r--r--,
      Last Modified=17Feb2021:12:26:23,
      File Size (bytes)=5

NOTE: unknown option -- wusage: sftp [-46aCfpqrv] [-B buffer_size] [-b batchfile] [-c cipher]          [-D sftp_server_path] [-F 
      ssh_config] [-i identity_file]          [-J destination] [-l limit] [-o ssh_option] [-P port]          [-R num_requests] 
      [-S program] [-s subsystem | sftp_server]          destination
NOTE: cd "/my directory"
ERROR: Directory or file /my directory/TEST_DESCONSIDERAR.txt doesn't exist.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
      real time           1.50 seconds
      cpu time            0.00 seconds&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 24 Feb 2021 11:57:57 GMT</pubDate>
    <dc:creator>MariaD</dc:creator>
    <dc:date>2021-02-24T11:57:57Z</dc:date>
    <item>
      <title>Transfer file SFTP | Filename</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transfer-file-SFTP-Filename/m-p/719880#M222947</link>
      <description>&lt;P&gt;Hi folks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried to transfer a file using FILENAME SFTP. I tested my credential and access directly from SAS Server (using PuTTY with SFTP command) and works fine.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm running the following code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename server sftp "TEST.txt"  host='XXX.XX.XX.XX'
cd='folder' user='myUser' optionsx='-pw "myPass"';  

data _null_;
infile "/folder_on_SASSERver/file.txt" recfm=n ;
input x $char1. @@;
file server recfm=s ;
put x $char1. @@;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The file in "infile" sentence is located on SAS Server, I double check the path and it's correct.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But the following errors appears:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ERROR: Physical file does not exist, /folder_on_SASSERver/file.txt.
NOTE: sftp: illegal option -- pusage: sftp [-1Cv] [-B buffer_size] [-b batchfile] [-F ssh_config]            [-o ssh_option] [-P 
      sftp_server_path] [-R num_requests]            [-S program] [-s subsystem | sftp_server] host       sftp [user@]host[:file 
      ...]       sftp [user@]host[:dir[/]]       sftp -b batchfile [user@]host
NOTE: cd "folder"
ERROR: Directory or file TEST.txt doesn't exist.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
      real time           1.50 seconds
      cpu time            0.00 seconds&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Any idea why it's happens?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2021 12:43:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transfer-file-SFTP-Filename/m-p/719880#M222947</guid>
      <dc:creator>MariaD</dc:creator>
      <dc:date>2021-02-17T12:43:35Z</dc:date>
    </item>
    <item>
      <title>Re: Transfer file SFTP | Filename</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transfer-file-SFTP-Filename/m-p/719890#M222951</link>
      <description>&lt;P&gt;Looks like your FILENAME SFTP statement syntax doesn't &lt;A href="https://go.documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.2&amp;amp;docsetId=lestmtsglobal&amp;amp;docsetTarget=p0xln1fiwsr340n1xxf4mkmfxp6f.htm&amp;amp;locale=en" target="_self"&gt;match the docs&lt;/A&gt;, and your DATA step is trying to read a local file that doesn't exist.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First, test to ensure the local file exists:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   /* Verify the file you are reading from is available on the SAS server */
   infile "~/test.txt" truncover;
   /* Read a record from source */
   input;
   /* Write the record to the log */
   put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Review the log to ensure you are reading the file correctly. Fiddle with this code until you get it to work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Next, modify the code to write to the SFTP location instead of the log:&lt;/P&gt;
&lt;P&gt;Try something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename outfile sftp "/user/myfolder/text.txt"  host='XXX.XX.XX.XX' user='myUser' optionsx='-pw "myPass"' ;   
&lt;BR /&gt;data _null_;
   /* Read from file on the SAS server */
   infile "~/test.txt" truncover;&lt;BR /&gt;   input;
   /* Write the record to SFTP destination file */
   file myFolder;
   put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This should help you isolate the problem and get things working more quickly. Let me know how it goes!&lt;/P&gt;
&lt;P&gt;May the SAS be with you!&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2021 13:15:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transfer-file-SFTP-Filename/m-p/719890#M222951</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2021-02-17T13:15:13Z</dc:date>
    </item>
    <item>
      <title>Re: Transfer file SFTP | Filename</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transfer-file-SFTP-Filename/m-p/719892#M222952</link>
      <description>&lt;P&gt;First of all, when SAS tells you a file is not there, it's not there, period. This may have multiple reasons, correct spelling being one of them (UNIX is case sensitive, so EVERY SINGLE character must be spelled correctly upper- or lowercase). Did you determine the path to the file by logging on to the server via SSH and navigating to the directory, or did you take it from the Files section in EG? The Files in EG usually start at your home directory ($HOME).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second, FILENAME SFTP does not support passwords in any way. You MUST set up passwordless authentication (public/private key) before you can use SFTP from SAS.&lt;/P&gt;
&lt;P&gt;The UNIX sftp program does not have an option to supply passwords on the commandline, for security reasons (commandlines of processes are viewable by anyone on the system).&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2021 13:19:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transfer-file-SFTP-Filename/m-p/719892#M222952</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-02-17T13:19:14Z</dc:date>
    </item>
    <item>
      <title>Re: Transfer file SFTP | Filename</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transfer-file-SFTP-Filename/m-p/721537#M223660</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13728"&gt;@SASJedi&lt;/a&gt;&amp;nbsp;, I double check and the file on SAS server exist and it's in the correct location but still the same error appears.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's like the process tried to read from SFTP instead of write:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename archivo sftp "/my directory/TEST_DESCONSIDERAR.txt"  host='XX.XX.XX.XX'
user='myuser' optionsx=' -pw "myPassword"' DEBUG recfm=v;  

filename test '/work_SAS/test.txt';

data _null_;
infile test recfm=n ;
input;
file archivo  ;
put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;NOTE: UNBUFFERED is the default with RECFM=N.
NOTE: The infile TEST is:
      Filename=/work_SAS/test.txt,
      Owner Name=sas,Group Name=sas,
      Access Permission=-rw-r--r--,
      Last Modified=17Feb2021:12:26:23,
      File Size (bytes)=5

NOTE: unknown option -- wusage: sftp [-46aCfpqrv] [-B buffer_size] [-b batchfile] [-c cipher]          [-D sftp_server_path] [-F 
      ssh_config] [-i identity_file]          [-J destination] [-l limit] [-o ssh_option] [-P port]          [-R num_requests] 
      [-S program] [-s subsystem | sftp_server]          destination
NOTE: cd "/my directory"
ERROR: Directory or file /my directory/TEST_DESCONSIDERAR.txt doesn't exist.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
      real time           1.50 seconds
      cpu time            0.00 seconds&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 11:57:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transfer-file-SFTP-Filename/m-p/721537#M223660</guid>
      <dc:creator>MariaD</dc:creator>
      <dc:date>2021-02-24T11:57:57Z</dc:date>
    </item>
    <item>
      <title>Re: Transfer file SFTP | Filename</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transfer-file-SFTP-Filename/m-p/721543#M223664</link>
      <description>&lt;P&gt;The ERROR is about the remote file, and it cannot "find" it because it cannot establish the SFTP connection.&lt;/P&gt;
&lt;P&gt;And that happens because you try to use an invalid option.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 12:19:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transfer-file-SFTP-Filename/m-p/721543#M223664</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-02-24T12:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: Transfer file SFTP | Filename</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transfer-file-SFTP-Filename/m-p/721545#M223666</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;. So, the optionsx=' -pw' is not allow?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 12:31:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transfer-file-SFTP-Filename/m-p/721545#M223666</guid>
      <dc:creator>MariaD</dc:creator>
      <dc:date>2021-02-24T12:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: Transfer file SFTP | Filename</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transfer-file-SFTP-Filename/m-p/721546#M223667</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Please read the second paragraph of my previous&lt;/STRONG&gt; &lt;STRONG&gt;post.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;There I have explained that the external sftp program (which SAS uses) does not have such an option, and why such an option can not exist in the first place.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 12:36:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transfer-file-SFTP-Filename/m-p/721546#M223667</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-02-24T12:36:28Z</dc:date>
    </item>
  </channel>
</rss>

